From 16d0ba4a14fd6bede3e8b3520af7deaefb4f8068 Mon Sep 17 00:00:00 2001 From: Cosimo Oliboni Date: Sat, 23 Jan 2010 16:15:28 +0000 Subject: [PATCH] --- .../contribs/ng_assembly/common/ascii.ma | 167 -- .../ng_assembly/common/ascii_lemmas.ma | 183 -- .../contribs/ng_assembly/common/list.ma | 84 - .../ng_assembly/common/list_lemmas.ma | 166 -- .../ng_assembly/common/list_utility.ma | 348 ---- .../ng_assembly/common/list_utility_lemmas.ma | 585 ------- .../matita/contribs/ng_assembly/common/nat.ma | 219 --- .../contribs/ng_assembly/common/nat_lemmas.ma | 176 -- .../contribs/ng_assembly/common/nat_to_num.ma | 78 - .../contribs/ng_assembly/common/option.ma | 43 - .../ng_assembly/common/option_lemmas.ma | 172 -- .../contribs/ng_assembly/common/prod.ma | 111 -- .../ng_assembly/common/prod_lemmas.ma | 930 ---------- .../contribs/ng_assembly/common/sigma.ma | 52 - .../contribs/ng_assembly/common/string.ma | 52 - .../ng_assembly/common/string_lemmas.ma | 183 -- .../contribs/ng_assembly/common/theory.ma | 609 ------- .../contribs/ng_assembly/compiler/ast_type.ma | 136 -- .../ng_assembly/compiler/ast_type_lemmas.ma | 301 ---- .../ng_assembly/compiler/environment.ma | 64 - .../ng_assembly/compiler/preast_tree.ma | 115 -- .../ng_assembly/freescale/load_write.ma | 946 ---------- .../contribs/ng_assembly/freescale/model.ma | 357 ---- .../contribs/ng_assembly/freescale/multivm.ma | 1307 -------------- .../ng_assembly/freescale/multivm_lemmas.ma | 57 - .../contribs/ng_assembly/freescale/status.ma | 1275 -------------- .../ng_assembly/freescale/status_lemmas.ma | 1536 ----------------- .../ng_assembly/freescale/translation.ma | 247 --- .../freescale/translation_lemmas.ma | 88 - .../freescale_tests/medium_tests.ma | 887 ---------- .../freescale_tests/medium_tests_tools.ma | 592 ------- .../freescale_tests/micro_tests1.ma | 143 -- .../freescale_tests/micro_tests10.ma | 103 -- .../freescale_tests/micro_tests2.ma | 87 - .../freescale_tests/micro_tests3.ma | 76 - .../freescale_tests/micro_tests4.ma | 152 -- .../freescale_tests/micro_tests4bis.ma | 89 - .../freescale_tests/micro_tests5.ma | 93 - .../freescale_tests/micro_tests6.ma | 100 -- .../freescale_tests/micro_tests7.ma | 78 - .../freescale_tests/micro_tests8.ma | 87 - .../freescale_tests/micro_tests9.ma | 104 -- .../freescale_tests/micro_tests_tools.ma | 80 - .../contribs/ng_assembly/memory/memory_abs.ma | 243 --- .../ng_assembly/memory/memory_bits.ma | 181 -- .../ng_assembly/memory/memory_func.ma | 79 - .../ng_assembly/memory/memory_struct.ma | 659 ------- .../ng_assembly/memory/memory_trees.ma | 148 -- .../contribs/ng_assembly/num/bitrigesim.ma | 189 -- .../ng_assembly/num/bitrigesim_lemmas.ma | 137 -- .../matita/contribs/ng_assembly/num/bool.ma | 78 - .../contribs/ng_assembly/num/bool_lemmas.ma | 324 ---- .../matita/contribs/ng_assembly/num/byte8.ma | 408 ----- .../contribs/ng_assembly/num/byte8_lemmas.ma | 338 ---- .../contribs/ng_assembly/num/exadecim.ma | 1427 --------------- .../ng_assembly/num/exadecim_lemmas.ma | 346 ---- .../matita/contribs/ng_assembly/num/oct.ma | 78 - .../contribs/ng_assembly/num/oct_lemmas.ma | 93 - .../contribs/ng_assembly/num/quatern.ma | 66 - .../ng_assembly/num/quatern_lemmas.ma | 93 - .../matita/contribs/ng_assembly/num/word16.ma | 763 -------- .../contribs/ng_assembly/num/word16_lemmas.ma | 377 ---- .../matita/contribs/ng_assembly/num/word32.ma | 248 --- .../contribs/ng_assembly/num/word32_lemmas.ma | 377 ---- .../ng_assembly/opcodes/HC05_opcode_base.ma | 222 --- .../ng_assembly/opcodes/HC05_table.ma | 378 ---- .../ng_assembly/opcodes/HC05_table_tests.ma | 69 - .../ng_assembly/opcodes/HC08_opcode_base.ma | 330 ---- .../ng_assembly/opcodes/HC08_table.ma | 475 ----- .../ng_assembly/opcodes/HC08_table_tests.ma | 106 -- .../ng_assembly/opcodes/HCS08_opcode_base.ma | 333 ---- .../ng_assembly/opcodes/HCS08_table.ma | 487 ------ .../ng_assembly/opcodes/HCS08_table_tests.ma | 101 -- .../ng_assembly/opcodes/RS08_opcode_base.ma | 183 -- .../ng_assembly/opcodes/RS08_table.ma | 396 ----- .../ng_assembly/opcodes/RS08_table_tests.ma | 65 - .../ng_assembly/opcodes/byte_or_word.ma | 35 - .../contribs/ng_assembly/opcodes/opcode.ma | 202 --- .../contribs/ng_assembly/universe/universe.ma | 233 --- 79 files changed, 23525 deletions(-) delete mode 100755 helm/software/matita/contribs/ng_assembly/common/ascii.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/ascii_lemmas.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/list.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/list_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/list_utility.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/list_utility_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/nat.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/nat_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/nat_to_num.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/option.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/option_lemmas.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/prod.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/prod_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/sigma.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/string.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/common/string_lemmas.ma delete mode 100644 helm/software/matita/contribs/ng_assembly/common/theory.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/compiler/ast_type.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/compiler/ast_type_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/compiler/environment.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/compiler/preast_tree.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/load_write.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/model.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/multivm.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/multivm_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/status.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/status_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/translation.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale/translation_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests_tools.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests1.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests10.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests2.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests3.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4bis.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests5.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests6.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests7.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests8.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests9.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests_tools.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/memory/memory_abs.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/memory/memory_bits.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/memory/memory_func.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/memory/memory_struct.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/memory/memory_trees.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/bitrigesim.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/bitrigesim_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/bool.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/bool_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/byte8.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/byte8_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/exadecim.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/exadecim_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/oct.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/quatern.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/word16.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/word16_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/word32.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/num/word32_lemmas.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC05_opcode_base.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC05_table.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC05_table_tests.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC08_opcode_base.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC08_table.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HC08_table_tests.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HCS08_opcode_base.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table_tests.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/RS08_opcode_base.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/RS08_table.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/RS08_table_tests.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/byte_or_word.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/opcodes/opcode.ma delete mode 100755 helm/software/matita/contribs/ng_assembly/universe/universe.ma diff --git a/helm/software/matita/contribs/ng_assembly/common/ascii.ma b/helm/software/matita/contribs/ng_assembly/common/ascii.ma deleted file mode 100755 index ddb65df3a..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/ascii.ma +++ /dev/null @@ -1,167 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ************************** *) -(* DEFINIZIONE ASCII MINIMALE *) -(* ************************** *) - -ninductive ascii : Type ≝ -(* numeri *) - ch_0: ascii -| ch_1: ascii -| ch_2: ascii -| ch_3: ascii -| ch_4: ascii -| ch_5: ascii -| ch_6: ascii -| ch_7: ascii -| ch_8: ascii -| ch_9: ascii - -(* simboli *) -| ch__: ascii - -(* maiuscole *) -| ch_A: ascii -| ch_B: ascii -| ch_C: ascii -| ch_D: ascii -| ch_E: ascii -| ch_F: ascii -| ch_G: ascii -| ch_H: ascii -| ch_I: ascii -| ch_J: ascii -| ch_K: ascii -| ch_L: ascii -| ch_M: ascii -| ch_N: ascii -| ch_O: ascii -| ch_P: ascii -| ch_Q: ascii -| ch_R: ascii -| ch_S: ascii -| ch_T: ascii -| ch_U: ascii -| ch_V: ascii -| ch_W: ascii -| ch_X: ascii -| ch_Y: ascii -| ch_Z: ascii - -(* minuscole *) -| ch_a: ascii -| ch_b: ascii -| ch_c: ascii -| ch_d: ascii -| ch_e: ascii -| ch_f: ascii -| ch_g: ascii -| ch_h: ascii -| ch_i: ascii -| ch_j: ascii -| ch_k: ascii -| ch_l: ascii -| ch_m: ascii -| ch_n: ascii -| ch_o: ascii -| ch_p: ascii -| ch_q: ascii -| ch_r: ascii -| ch_s: ascii -| ch_t: ascii -| ch_u: ascii -| ch_v: ascii -| ch_w: ascii -| ch_x: ascii -| ch_y: ascii -| ch_z: ascii. - -(* confronto fra ascii *) -ndefinition eq_ascii ≝ -λc,c':ascii.match c with - [ ch_0 ⇒ match c' with [ ch_0 ⇒ true | _ ⇒ false ] - | ch_1 ⇒ match c' with [ ch_1 ⇒ true | _ ⇒ false ] - | ch_2 ⇒ match c' with [ ch_2 ⇒ true | _ ⇒ false ] - | ch_3 ⇒ match c' with [ ch_3 ⇒ true | _ ⇒ false ] - | ch_4 ⇒ match c' with [ ch_4 ⇒ true | _ ⇒ false ] - | ch_5 ⇒ match c' with [ ch_5 ⇒ true | _ ⇒ false ] - | ch_6 ⇒ match c' with [ ch_6 ⇒ true | _ ⇒ false ] - | ch_7 ⇒ match c' with [ ch_7 ⇒ true | _ ⇒ false ] - | ch_8 ⇒ match c' with [ ch_8 ⇒ true | _ ⇒ false ] - | ch_9 ⇒ match c' with [ ch_9 ⇒ true | _ ⇒ false ] - | ch__ ⇒ match c' with [ ch__ ⇒ true | _ ⇒ false ] - | ch_A ⇒ match c' with [ ch_A ⇒ true | _ ⇒ false ] - | ch_B ⇒ match c' with [ ch_B ⇒ true | _ ⇒ false ] - | ch_C ⇒ match c' with [ ch_C ⇒ true | _ ⇒ false ] - | ch_D ⇒ match c' with [ ch_D ⇒ true | _ ⇒ false ] - | ch_E ⇒ match c' with [ ch_E ⇒ true | _ ⇒ false ] - | ch_F ⇒ match c' with [ ch_F ⇒ true | _ ⇒ false ] - | ch_G ⇒ match c' with [ ch_G ⇒ true | _ ⇒ false ] - | ch_H ⇒ match c' with [ ch_H ⇒ true | _ ⇒ false ] - | ch_I ⇒ match c' with [ ch_I ⇒ true | _ ⇒ false ] - | ch_J ⇒ match c' with [ ch_J ⇒ true | _ ⇒ false ] - | ch_K ⇒ match c' with [ ch_K ⇒ true | _ ⇒ false ] - | ch_L ⇒ match c' with [ ch_L ⇒ true | _ ⇒ false ] - | ch_M ⇒ match c' with [ ch_M ⇒ true | _ ⇒ false ] - | ch_N ⇒ match c' with [ ch_N ⇒ true | _ ⇒ false ] - | ch_O ⇒ match c' with [ ch_O ⇒ true | _ ⇒ false ] - | ch_P ⇒ match c' with [ ch_P ⇒ true | _ ⇒ false ] - | ch_Q ⇒ match c' with [ ch_Q ⇒ true | _ ⇒ false ] - | ch_R ⇒ match c' with [ ch_R ⇒ true | _ ⇒ false ] - | ch_S ⇒ match c' with [ ch_S ⇒ true | _ ⇒ false ] - | ch_T ⇒ match c' with [ ch_T ⇒ true | _ ⇒ false ] - | ch_U ⇒ match c' with [ ch_U ⇒ true | _ ⇒ false ] - | ch_V ⇒ match c' with [ ch_V ⇒ true | _ ⇒ false ] - | ch_W ⇒ match c' with [ ch_W ⇒ true | _ ⇒ false ] - | ch_X ⇒ match c' with [ ch_X ⇒ true | _ ⇒ false ] - | ch_Y ⇒ match c' with [ ch_Y ⇒ true | _ ⇒ false ] - | ch_Z ⇒ match c' with [ ch_Z ⇒ true | _ ⇒ false ] - | ch_a ⇒ match c' with [ ch_a ⇒ true | _ ⇒ false ] - | ch_b ⇒ match c' with [ ch_b ⇒ true | _ ⇒ false ] - | ch_c ⇒ match c' with [ ch_c ⇒ true | _ ⇒ false ] - | ch_d ⇒ match c' with [ ch_d ⇒ true | _ ⇒ false ] - | ch_e ⇒ match c' with [ ch_e ⇒ true | _ ⇒ false ] - | ch_f ⇒ match c' with [ ch_f ⇒ true | _ ⇒ false ] - | ch_g ⇒ match c' with [ ch_g ⇒ true | _ ⇒ false ] - | ch_h ⇒ match c' with [ ch_h ⇒ true | _ ⇒ false ] - | ch_i ⇒ match c' with [ ch_i ⇒ true | _ ⇒ false ] - | ch_j ⇒ match c' with [ ch_j ⇒ true | _ ⇒ false ] - | ch_k ⇒ match c' with [ ch_k ⇒ true | _ ⇒ false ] - | ch_l ⇒ match c' with [ ch_l ⇒ true | _ ⇒ false ] - | ch_m ⇒ match c' with [ ch_m ⇒ true | _ ⇒ false ] - | ch_n ⇒ match c' with [ ch_n ⇒ true | _ ⇒ false ] - | ch_o ⇒ match c' with [ ch_o ⇒ true | _ ⇒ false ] - | ch_p ⇒ match c' with [ ch_p ⇒ true | _ ⇒ false ] - | ch_q ⇒ match c' with [ ch_q ⇒ true | _ ⇒ false ] - | ch_r ⇒ match c' with [ ch_r ⇒ true | _ ⇒ false ] - | ch_s ⇒ match c' with [ ch_s ⇒ true | _ ⇒ false ] - | ch_t ⇒ match c' with [ ch_t ⇒ true | _ ⇒ false ] - | ch_u ⇒ match c' with [ ch_u ⇒ true | _ ⇒ false ] - | ch_v ⇒ match c' with [ ch_v ⇒ true | _ ⇒ false ] - | ch_w ⇒ match c' with [ ch_w ⇒ true | _ ⇒ false ] - | ch_x ⇒ match c' with [ ch_x ⇒ true | _ ⇒ false ] - | ch_y ⇒ match c' with [ ch_y ⇒ true | _ ⇒ false ] - | ch_z ⇒ match c' with [ ch_z ⇒ true | _ ⇒ false ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/common/ascii_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/ascii_lemmas.ma deleted file mode 100755 index dd1eec486..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/ascii_lemmas.ma +++ /dev/null @@ -1,183 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/ascii.ma". -include "num/bool_lemmas.ma". - -(* ************************** *) -(* DEFINIZIONE ASCII MINIMALE *) -(* ************************** *) - -(* -ndefinition ascii_destruct_aux ≝ -Πc1,c2.ΠP:Prop.c1 = c2 → - match eq_ascii c1 c2 with [ true ⇒ P → P | false ⇒ P ]. - -nlemma ascii_destruct : ascii_destruct_aux. - #c1; #c2; #P; #H; - nrewrite < H; - nelim c1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma eq_to_eqascii : ∀n1,n2.n1 = n2 → eq_ascii n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqascii_to_neq : ∀n1,n2.eq_ascii n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_ascii n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqascii n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqascii_to_eq1 : ∀a2.eq_ascii ch_0 a2 = true → ch_0 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##1: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq2 : ∀a2.eq_ascii ch_1 a2 = true → ch_1 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##2: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq3 : ∀a2.eq_ascii ch_2 a2 = true → ch_2 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##3: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq4 : ∀a2.eq_ascii ch_3 a2 = true → ch_3 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##4: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq5 : ∀a2.eq_ascii ch_4 a2 = true → ch_4 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##5: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq6 : ∀a2.eq_ascii ch_5 a2 = true → ch_5 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##6: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq7 : ∀a2.eq_ascii ch_6 a2 = true → ch_6 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##7: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq8 : ∀a2.eq_ascii ch_7 a2 = true → ch_7 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##8: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq9 : ∀a2.eq_ascii ch_8 a2 = true → ch_8 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##9: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq10 : ∀a2.eq_ascii ch_9 a2 = true → ch_9 = a2. #a2; ncases a2; nnormalize; #H; ##[ ##10: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq11 : ∀a2.eq_ascii ch__ a2 = true → ch__ = a2. #a2; ncases a2; nnormalize; #H; ##[ ##11: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq12 : ∀a2.eq_ascii ch_A a2 = true → ch_A = a2. #a2; ncases a2; nnormalize; #H; ##[ ##12: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq13 : ∀a2.eq_ascii ch_B a2 = true → ch_B = a2. #a2; ncases a2; nnormalize; #H; ##[ ##13: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq14 : ∀a2.eq_ascii ch_C a2 = true → ch_C = a2. #a2; ncases a2; nnormalize; #H; ##[ ##14: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq15 : ∀a2.eq_ascii ch_D a2 = true → ch_D = a2. #a2; ncases a2; nnormalize; #H; ##[ ##15: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq16 : ∀a2.eq_ascii ch_E a2 = true → ch_E = a2. #a2; ncases a2; nnormalize; #H; ##[ ##16: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq17 : ∀a2.eq_ascii ch_F a2 = true → ch_F = a2. #a2; ncases a2; nnormalize; #H; ##[ ##17: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq18 : ∀a2.eq_ascii ch_G a2 = true → ch_G = a2. #a2; ncases a2; nnormalize; #H; ##[ ##18: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq19 : ∀a2.eq_ascii ch_H a2 = true → ch_H = a2. #a2; ncases a2; nnormalize; #H; ##[ ##19: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq20 : ∀a2.eq_ascii ch_I a2 = true → ch_I = a2. #a2; ncases a2; nnormalize; #H; ##[ ##20: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq21 : ∀a2.eq_ascii ch_J a2 = true → ch_J = a2. #a2; ncases a2; nnormalize; #H; ##[ ##21: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq22 : ∀a2.eq_ascii ch_K a2 = true → ch_K = a2. #a2; ncases a2; nnormalize; #H; ##[ ##22: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq23 : ∀a2.eq_ascii ch_L a2 = true → ch_L = a2. #a2; ncases a2; nnormalize; #H; ##[ ##23: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq24 : ∀a2.eq_ascii ch_M a2 = true → ch_M = a2. #a2; ncases a2; nnormalize; #H; ##[ ##24: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq25 : ∀a2.eq_ascii ch_N a2 = true → ch_N = a2. #a2; ncases a2; nnormalize; #H; ##[ ##25: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq26 : ∀a2.eq_ascii ch_O a2 = true → ch_O = a2. #a2; ncases a2; nnormalize; #H; ##[ ##26: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq27 : ∀a2.eq_ascii ch_P a2 = true → ch_P = a2. #a2; ncases a2; nnormalize; #H; ##[ ##27: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq28 : ∀a2.eq_ascii ch_Q a2 = true → ch_Q = a2. #a2; ncases a2; nnormalize; #H; ##[ ##28: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq29 : ∀a2.eq_ascii ch_R a2 = true → ch_R = a2. #a2; ncases a2; nnormalize; #H; ##[ ##29: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq30 : ∀a2.eq_ascii ch_S a2 = true → ch_S = a2. #a2; ncases a2; nnormalize; #H; ##[ ##30: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq31 : ∀a2.eq_ascii ch_T a2 = true → ch_T = a2. #a2; ncases a2; nnormalize; #H; ##[ ##31: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq32 : ∀a2.eq_ascii ch_U a2 = true → ch_U = a2. #a2; ncases a2; nnormalize; #H; ##[ ##32: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq33 : ∀a2.eq_ascii ch_V a2 = true → ch_V = a2. #a2; ncases a2; nnormalize; #H; ##[ ##33: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq34 : ∀a2.eq_ascii ch_W a2 = true → ch_W = a2. #a2; ncases a2; nnormalize; #H; ##[ ##34: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq35 : ∀a2.eq_ascii ch_X a2 = true → ch_X = a2. #a2; ncases a2; nnormalize; #H; ##[ ##35: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq36 : ∀a2.eq_ascii ch_Y a2 = true → ch_Y = a2. #a2; ncases a2; nnormalize; #H; ##[ ##36: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq37 : ∀a2.eq_ascii ch_Z a2 = true → ch_Z = a2. #a2; ncases a2; nnormalize; #H; ##[ ##37: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq38 : ∀a2.eq_ascii ch_a a2 = true → ch_a = a2. #a2; ncases a2; nnormalize; #H; ##[ ##38: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq39 : ∀a2.eq_ascii ch_b a2 = true → ch_b = a2. #a2; ncases a2; nnormalize; #H; ##[ ##39: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq40 : ∀a2.eq_ascii ch_c a2 = true → ch_c = a2. #a2; ncases a2; nnormalize; #H; ##[ ##40: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq41 : ∀a2.eq_ascii ch_d a2 = true → ch_d = a2. #a2; ncases a2; nnormalize; #H; ##[ ##41: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq42 : ∀a2.eq_ascii ch_e a2 = true → ch_e = a2. #a2; ncases a2; nnormalize; #H; ##[ ##42: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq43 : ∀a2.eq_ascii ch_f a2 = true → ch_f = a2. #a2; ncases a2; nnormalize; #H; ##[ ##43: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq44 : ∀a2.eq_ascii ch_g a2 = true → ch_g = a2. #a2; ncases a2; nnormalize; #H; ##[ ##44: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq45 : ∀a2.eq_ascii ch_h a2 = true → ch_h = a2. #a2; ncases a2; nnormalize; #H; ##[ ##45: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq46 : ∀a2.eq_ascii ch_i a2 = true → ch_i = a2. #a2; ncases a2; nnormalize; #H; ##[ ##46: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq47 : ∀a2.eq_ascii ch_j a2 = true → ch_j = a2. #a2; ncases a2; nnormalize; #H; ##[ ##47: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq48 : ∀a2.eq_ascii ch_k a2 = true → ch_k = a2. #a2; ncases a2; nnormalize; #H; ##[ ##48: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq49 : ∀a2.eq_ascii ch_l a2 = true → ch_l = a2. #a2; ncases a2; nnormalize; #H; ##[ ##49: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq50 : ∀a2.eq_ascii ch_m a2 = true → ch_m = a2. #a2; ncases a2; nnormalize; #H; ##[ ##50: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq51 : ∀a2.eq_ascii ch_n a2 = true → ch_n = a2. #a2; ncases a2; nnormalize; #H; ##[ ##51: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq52 : ∀a2.eq_ascii ch_o a2 = true → ch_o = a2. #a2; ncases a2; nnormalize; #H; ##[ ##52: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq53 : ∀a2.eq_ascii ch_p a2 = true → ch_p = a2. #a2; ncases a2; nnormalize; #H; ##[ ##53: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq54 : ∀a2.eq_ascii ch_q a2 = true → ch_q = a2. #a2; ncases a2; nnormalize; #H; ##[ ##54: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq55 : ∀a2.eq_ascii ch_r a2 = true → ch_r = a2. #a2; ncases a2; nnormalize; #H; ##[ ##55: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq56 : ∀a2.eq_ascii ch_s a2 = true → ch_s = a2. #a2; ncases a2; nnormalize; #H; ##[ ##56: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq57 : ∀a2.eq_ascii ch_t a2 = true → ch_t = a2. #a2; ncases a2; nnormalize; #H; ##[ ##57: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq58 : ∀a2.eq_ascii ch_u a2 = true → ch_u = a2. #a2; ncases a2; nnormalize; #H; ##[ ##58: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq59 : ∀a2.eq_ascii ch_v a2 = true → ch_v = a2. #a2; ncases a2; nnormalize; #H; ##[ ##59: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq60 : ∀a2.eq_ascii ch_w a2 = true → ch_w = a2. #a2; ncases a2; nnormalize; #H; ##[ ##60: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq61 : ∀a2.eq_ascii ch_x a2 = true → ch_x = a2. #a2; ncases a2; nnormalize; #H; ##[ ##61: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq62 : ∀a2.eq_ascii ch_y a2 = true → ch_y = a2. #a2; ncases a2; nnormalize; #H; ##[ ##62: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqascii_to_eq63 : ∀a2.eq_ascii ch_z a2 = true → ch_z = a2. #a2; ncases a2; nnormalize; #H; ##[ ##63: napply refl_eq | ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. - -nlemma eqascii_to_eq : ∀c1,c2.eq_ascii c1 c2 = true → c1 = c2. - #c1; ncases c1; - ##[ ##1: napply eqascii_to_eq1 ##| ##2: napply eqascii_to_eq2 - ##| ##3: napply eqascii_to_eq3 ##| ##4: napply eqascii_to_eq4 - ##| ##5: napply eqascii_to_eq5 ##| ##6: napply eqascii_to_eq6 - ##| ##7: napply eqascii_to_eq7 ##| ##8: napply eqascii_to_eq8 - ##| ##9: napply eqascii_to_eq9 ##| ##10: napply eqascii_to_eq10 - ##| ##11: napply eqascii_to_eq11 ##| ##12: napply eqascii_to_eq12 - ##| ##13: napply eqascii_to_eq13 ##| ##14: napply eqascii_to_eq14 - ##| ##15: napply eqascii_to_eq15 ##| ##16: napply eqascii_to_eq16 - ##| ##17: napply eqascii_to_eq17 ##| ##18: napply eqascii_to_eq18 - ##| ##19: napply eqascii_to_eq19 ##| ##20: napply eqascii_to_eq20 - ##| ##21: napply eqascii_to_eq21 ##| ##22: napply eqascii_to_eq22 - ##| ##23: napply eqascii_to_eq23 ##| ##24: napply eqascii_to_eq24 - ##| ##25: napply eqascii_to_eq25 ##| ##26: napply eqascii_to_eq26 - ##| ##27: napply eqascii_to_eq27 ##| ##28: napply eqascii_to_eq28 - ##| ##29: napply eqascii_to_eq29 ##| ##30: napply eqascii_to_eq30 - ##| ##31: napply eqascii_to_eq31 ##| ##32: napply eqascii_to_eq32 - ##| ##33: napply eqascii_to_eq33 ##| ##34: napply eqascii_to_eq34 - ##| ##35: napply eqascii_to_eq35 ##| ##36: napply eqascii_to_eq36 - ##| ##37: napply eqascii_to_eq37 ##| ##38: napply eqascii_to_eq38 - ##| ##39: napply eqascii_to_eq39 ##| ##40: napply eqascii_to_eq40 - ##| ##41: napply eqascii_to_eq41 ##| ##42: napply eqascii_to_eq42 - ##| ##43: napply eqascii_to_eq43 ##| ##44: napply eqascii_to_eq44 - ##| ##45: napply eqascii_to_eq45 ##| ##46: napply eqascii_to_eq46 - ##| ##47: napply eqascii_to_eq47 ##| ##48: napply eqascii_to_eq48 - ##| ##49: napply eqascii_to_eq49 ##| ##50: napply eqascii_to_eq50 - ##| ##51: napply eqascii_to_eq51 ##| ##52: napply eqascii_to_eq52 - ##| ##53: napply eqascii_to_eq53 ##| ##54: napply eqascii_to_eq54 - ##| ##55: napply eqascii_to_eq55 ##| ##56: napply eqascii_to_eq56 - ##| ##57: napply eqascii_to_eq57 ##| ##58: napply eqascii_to_eq58 - ##| ##59: napply eqascii_to_eq59 ##| ##60: napply eqascii_to_eq60 - ##| ##61: napply eqascii_to_eq61 ##| ##62: napply eqascii_to_eq62 - ##| ##63: napply eqascii_to_eq63 ##] -nqed. - -nlemma neq_to_neqascii : ∀n1,n2.n1 ≠ n2 → eq_ascii n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_ascii n1 n2)); - napply (not_to_not (eq_ascii n1 n2 = true) (n1 = n2) ? H); - napply (eqascii_to_eq n1 n2). -nqed. - -nlemma decidable_ascii : ∀x,y:ascii.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_ascii x y = true) (eq_ascii x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqascii_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqascii_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqascii : symmetricT ascii bool eq_ascii. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_ascii n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqascii n1 n2 H); - napply (symmetric_eq ? (eq_ascii n2 n1) false); - napply (neq_to_neqascii n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/list.ma b/helm/software/matita/contribs/ng_assembly/common/list.ma deleted file mode 100644 index 5bd83a936..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/list.ma +++ /dev/null @@ -1,84 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| A.Asperti, C.Sacerdoti Coen, *) -(* ||A|| E.Tassi, S.Zacchiroli *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU Lesser General Public License Version 2.1 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/theory.ma". - -(* *************** *) -(* LISTE GENERICHE *) -(* *************** *) - -ninductive list (A:Type) : Type ≝ - nil: list A -| cons: A → list A → list A. - -nlet rec append A (l1: list A) l2 on l1 ≝ - match l1 with - [ nil ⇒ l2 - | (cons hd tl) ⇒ cons A hd (append A tl l2) ]. - -notation "hvbox(hd break :: tl)" - right associative with precedence 47 - for @{'cons $hd $tl}. - -notation "[ list0 x sep ; ]" - non associative with precedence 90 - for ${fold right @'nil rec acc @{'cons $x $acc}}. - -notation "hvbox(l1 break @ l2)" - right associative with precedence 47 - for @{'append $l1 $l2 }. - -interpretation "nil" 'nil = (nil ?). -interpretation "cons" 'cons hd tl = (cons ? hd tl). -interpretation "append" 'append l1 l2 = (append ? l1 l2). - -(* ************** *) -(* NON-EMPTY LIST *) -(* ************** *) - -(* lista non vuota *) -ninductive ne_list (A:Type) : Type ≝ - | ne_nil: A → ne_list A - | ne_cons: A → ne_list A → ne_list A. - -(* append *) -nlet rec ne_append (A:Type) (l1,l2:ne_list A) on l1 ≝ - match l1 with - [ ne_nil hd ⇒ ne_cons A hd l2 - | ne_cons hd tl ⇒ ne_cons A hd (ne_append A tl l2) ]. - -notation "hvbox(hd break §§ tl)" - right associative with precedence 46 - for @{'ne_cons $hd $tl}. - -(* \laquo \raquo *) -notation "« list0 x sep ; break £ y break »" - non associative with precedence 90 - for ${fold right @{'ne_nil $y } rec acc @{'ne_cons $x $acc}}. - -notation "hvbox(l1 break & l2)" - right associative with precedence 47 - for @{'ne_append $l1 $l2 }. - -interpretation "ne_nil" 'ne_nil hd = (ne_nil ? hd). -interpretation "ne_cons" 'ne_cons hd tl = (ne_cons ? hd tl). -interpretation "ne_append" 'ne_append l1 l2 = (ne_append ? l1 l2). diff --git a/helm/software/matita/contribs/ng_assembly/common/list_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/list_lemmas.ma deleted file mode 100644 index 3be3a0a89..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/list_lemmas.ma +++ /dev/null @@ -1,166 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| A.Asperti, C.Sacerdoti Coen, *) -(* ||A|| E.Tassi, S.Zacchiroli *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU Lesser General Public License Version 2.1 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/list.ma". - -(* *************** *) -(* LISTE GENERICHE *) -(* *************** *) - -nlemma list_destruct_1 : ∀T.∀x1,x2:T.∀y1,y2:list T.cons T x1 y1 = cons T x2 y2 → x1 = x2. - #T; #x1; #x2; #y1; #y2; #H; - nchange with (match cons T x2 y2 with [ nil ⇒ False | cons a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma list_destruct_2 : ∀T.∀x1,x2:T.∀y1,y2:list T.cons T x1 y1 = cons T x2 y2 → y1 = y2. - #T; #x1; #x2; #y1; #y2; #H; - nchange with (match cons T x2 y2 with [ nil ⇒ False | cons _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -(* !!! da togliere *) -nlemma list_destruct_cons_nil : ∀T.∀x:T.∀y:list T.cons T x y = nil T → False. - #T; #x; #y; #H; - nchange with (match cons T x y with [ nil ⇒ True | cons a b ⇒ False ]); - nrewrite > H; - nnormalize; - napply I. -nqed. - -(* !!! da togliere *) -nlemma list_destruct_nil_cons : ∀T.∀x:T.∀y:list T.nil T = cons T x y → False. - #T; #x; #y; #H; - nchange with (match cons T x y with [ nil ⇒ True | cons a b ⇒ False ]); - nrewrite < H; - nnormalize; - napply I. -nqed. - -nlemma append_nil : ∀T:Type.∀l:list T.(l@[]) = l. - #T; #l; - nelim l; - nnormalize; - ##[ ##1: napply refl_eq - ##| ##2: #x; #y; #H; - nrewrite > H; - napply refl_eq - ##] -nqed. - -nlemma associative_list : ∀T.associative (list T) (append T). - #T; #x; #y; #z; - nelim x; - nnormalize; - ##[ ##1: napply refl_eq - ##| ##2: #a; #b; #H; - nrewrite > H; - napply refl_eq - ##] -nqed. - -nlemma cons_append_commute : ∀T:Type.∀l1,l2:list T.∀a:T.a :: (l1 @ l2) = (a :: l1) @ l2. - #T; #l1; #l2; #a; - nnormalize; - napply refl_eq. -nqed. - -nlemma append_cons_commute : ∀T:Type.∀a:T.∀l,l1:list T.l @ (a::l1) = (l@[a]) @ l1. - #T; #a; #l; #l1; - nrewrite > (associative_list T l [a] l1); - nnormalize; - napply refl_eq. -nqed. - -(* ************** *) -(* NON-EMPTY LIST *) -(* ************** *) - -nlemma nelist_destruct_nil_nil : ∀T.∀x1,x2:T.ne_nil T x1 = ne_nil T x2 → x1 = x2. - #T; #x1; #x2; #H; - nchange with (match ne_nil T x2 with [ ne_cons _ _ ⇒ False | ne_nil a ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma nelist_destruct_cons_cons_1 : ∀T.∀x1,x2:T.∀y1,y2:ne_list T.ne_cons T x1 y1 = ne_cons T x2 y2 → x1 = x2. - #T; #x1; #x2; #y1; #y2; #H; - nchange with (match ne_cons T x2 y2 with [ ne_nil _ ⇒ False | ne_cons a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma nelist_destruct_cons_cons_2 : ∀T.∀x1,x2:T.∀y1,y2:ne_list T.ne_cons T x1 y1 = ne_cons T x2 y2 → y1 = y2. - #T; #x1; #x2; #y1; #y2; #H; - nchange with (match ne_cons T x2 y2 with [ ne_nil _ ⇒ False | ne_cons _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -(* !!! da togliere *) -nlemma nelist_destruct_cons_nil : ∀T.∀x1,x2:T.∀y1:ne_list T.ne_cons T x1 y1 = ne_nil T x2 → False. - #T; #x1; #x2; #y1; #H; - nchange with (match ne_cons T x1 y1 with [ ne_nil _ ⇒ True | ne_cons a b ⇒ False ]); - nrewrite > H; - nnormalize; - napply I. -nqed. - -(* !!! da togliere *) -nlemma nelist_destruct_nil_cons : ∀T.∀x1,x2:T.∀y2:ne_list T.ne_nil T x1 = ne_cons T x2 y2 → False. - #T; #x1; #x2; #y2; #H; - nchange with (match ne_cons T x2 y2 with [ ne_nil _ ⇒ True | ne_cons a b ⇒ False ]); - nrewrite < H; - nnormalize; - napply I. -nqed. - -nlemma associative_nelist : ∀T.associative (ne_list T) (ne_append T). - #T; #x; #y; #z; - nelim x; - nnormalize; - ##[ ##1: #hh; napply refl_eq - ##| ##2: #hh; #tt; #H; - nrewrite > H; - napply refl_eq - ##] -nqed. - -nlemma necons_append_commute : ∀T:Type.∀l1,l2:ne_list T.∀a:T.(a §§ (l1 & l2)) = ((a §§ l1) & l2). - #T; #l1; #l2; #a; - nnormalize; - napply refl_eq. -nqed. - -nlemma append_necons_commute : ∀T:Type.∀a:T.∀l,l1:ne_list T.(l & (a §§ l1)) = (l & «£a») & l1. - #T; #a; #l; #l1; - nrewrite > (associative_nelist T l «£a» l1); - nnormalize; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/list_utility.ma b/helm/software/matita/contribs/ng_assembly/common/list_utility.ma deleted file mode 100755 index 154d85d36..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/list_utility.ma +++ /dev/null @@ -1,348 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/list.ma". -include "common/option.ma". -include "common/nat_lemmas.ma". - -(* *************** *) -(* LISTE GENERICHE *) -(* *************** *) - -(* listlen *) -nlet rec len_list (T:Type) (l:list T) on l ≝ - match l with [ nil ⇒ O | cons _ t ⇒ S (len_list T t) ]. - -(* vuota? *) -ndefinition is_empty_list ≝ -λT:Type.λl:list T.match l with [ nil ⇒ True | cons _ _ ⇒ False ]. - -ndefinition isb_empty_list ≝ -λT:Type.λl:list T.match l with [ nil ⇒ true | cons _ _ ⇒ false ]. - -ndefinition isnot_empty_list ≝ -λT:Type.λl:list T.match l with [ nil ⇒ False | cons _ _ ⇒ True ]. - -ndefinition isnotb_empty_list ≝ -λT:Type.λl:list T.match l with [ nil ⇒ false | cons _ _ ⇒ true ]. - -(* reverse *) -nlet rec reverse_list (T:Type) (l:list T) on l ≝ - match l with - [ nil ⇒ nil T - | cons h t ⇒ (reverse_list T t)@[h] - ]. - -(* getFirst *) -ndefinition get_first_list ≝ -λT:Type.λl:list T.match l with - [ nil ⇒ None ? - | cons h _ ⇒ Some ? h ]. - -(* getLast *) -ndefinition get_last_list ≝ -λT:Type.λl:list T.match reverse_list T l with - [ nil ⇒ None ? - | cons h _ ⇒ Some ? h ]. - -(* cutFirst *) -ndefinition cut_first_list ≝ -λT:Type.λl:list T.match l with - [ nil ⇒ nil T - | cons _ t ⇒ t ]. - -(* cutLast *) -ndefinition cut_last_list ≝ -λT:Type.λl:list T.match reverse_list T l with - [ nil ⇒ nil T - | cons _ t ⇒ reverse_list T t ]. - -(* apply f *) -nlet rec apply_f_list (T1,T2:Type) (l:list T1) (f:T1 → T2) on l ≝ -match l with - [ nil ⇒ nil T2 - | cons h t ⇒ cons T2 (f h) (apply_f_list T1 T2 t f) ]. - -(* fold right *) -nlet rec fold_right_list (T1,T2:Type) (f:T1 → T2 → T2) (acc:T2) (l:list T1) on l ≝ - match l with - [ nil ⇒ acc - | cons h t ⇒ f h (fold_right_list T1 T2 f acc t) - ]. - -(* double fold right *) -nlemma fold_right_list2_aux1 : -∀T.∀h,t.len_list T [] = len_list T (h::t) → False. - #T; #h; #t; - nnormalize; - #H; - ndestruct (*napply (nat_destruct_0_S ? H)*). -nqed. - -nlemma fold_right_list2_aux2 : -∀T.∀h,t.len_list T (h::t) = len_list T [] → False. - #T; #h; #t; - nnormalize; - #H; - ndestruct (*napply (nat_destruct_S_0 ? H)*). -nqed. - -nlemma fold_right_list2_aux3 : -∀T.∀h,h',t,t'.len_list T (h::t) = len_list T (h'::t') → len_list T t = len_list T t'. - #T; #h; #h'; #t; #t'; - nelim t; - nelim t'; - ##[ ##1: nnormalize; #H; napply refl_eq - ##| ##2: #a; #l'; #H; #H1; - nchange in H1:(%) with ((S O) = (S (S (len_list T l')))); - ndestruct (*nelim (nat_destruct_0_S ? (nat_destruct_S_S … H1))*) - ##| ##3: #a; #l'; #H; #H1; - nchange in H1:(%) with ((S (S (len_list T l'))) = (S O)); - ndestruct (*nelim (nat_destruct_S_0 ? (nat_destruct_S_S … H1))*) - ##| ##4: #a; #l; #H; #a1; #l1; #H1; #H2; - nchange in H2:(%) with ((S (S (len_list T l1))) = (S (S (len_list T l)))); - nchange with ((S (len_list T l1)) = (S (len_list T l))); - nrewrite > (nat_destruct_S_S … H2); - napply refl_eq - ##] -nqed. - -nlet rec fold_right_list2 (T1,T2:Type) (f:T1 → T1 → T2 → T2) (acc:T2) (l1:list T1) on l1 ≝ - match l1 - return λl1.Πl2.len_list T1 l1 = len_list T1 l2 → T2 - with - [ nil ⇒ λl2.match l2 return λl2.len_list T1 [] = len_list T1 l2 → T2 with - [ nil ⇒ λp:len_list T1 [] = len_list T1 [].acc - | cons h t ⇒ λp:len_list T1 [] = len_list T1 (h::t). - False_rect_Type0 ? (fold_right_list2_aux1 T1 h t p) - ] - | cons h t ⇒ λl2.match l2 return λl2.len_list T1 (h::t) = len_list T1 l2 → T2 with - [ nil ⇒ λp:len_list T1 (h::t) = len_list T1 []. - False_rect_Type0 ? (fold_right_list2_aux2 T1 h t p) - | cons h' t' ⇒ λp:len_list T1 (h::t) = len_list T1 (h'::t'). - f h h' (fold_right_list2 T1 T2 f acc t t' (fold_right_list2_aux3 T1 h h' t t' p)) - ] - ]. - -nlet rec bfold_right_list2 (T1:Type) (f:T1 → T1 → bool) (l1,l2:list T1) on l1 ≝ - match l1 with - [ nil ⇒ match l2 with - [ nil ⇒ true | cons h t ⇒ false ] - | cons h t ⇒ match l2 with - [ nil ⇒ false | cons h' t' ⇒ (f h h') ⊗ (bfold_right_list2 T1 f t t') - ] - ]. - -(* nth elem *) -nlet rec nth_list (T:Type) (l:list T) (n:nat) on l ≝ - match l with - [ nil ⇒ None ? - | cons h t ⇒ match n with - [ O ⇒ Some ? h | S n' ⇒ nth_list T t n' ] - ]. - -(* abs elem *) -ndefinition abs_list_aux1 : ∀T:Type.∀n.((len_list T []) > n) = true → False. - #T; nnormalize; #n; #H; ndestruct (*napply (bool_destruct … H)*). nqed. - -ndefinition abs_list_aux2 : ∀T:Type.∀h:T.∀t:list T.∀n.((len_list T (h::t)) > (S n) = true) → ((len_list T t) > n) = true. - #T; #h; #t; #n; nnormalize; #H; napply H. nqed. - -nlet rec abs_list (T:Type) (l:list T) on l ≝ - match l - return λl.Πn.(((len_list T l) > n) = true) → T - with - [ nil ⇒ λn.λp:(((len_list T []) > n) = true).False_rect_Type0 ? (abs_list_aux1 T n p) - | cons h t ⇒ λn. - match n with - [ O ⇒ λp:(((len_list T (h::t)) > O) = true).h - | S n' ⇒ λp:(((len_list T (h::t)) > (S n')) = true). - abs_list T t n' (abs_list_aux2 T h t n' p) - ] - ]. - -(* esempio: abs_list ? [ 1; 2; 3; 4 ] 2 (refl_eq …) = 0. *) - -(* ************** *) -(* NON-EMPTY LIST *) -(* ************** *) - -(* listlen *) -nlet rec len_neList (T:Type) (nl:ne_list T) on nl ≝ - match nl with [ ne_nil _ ⇒ (S O) | ne_cons _ t ⇒ S (len_neList T t) ]. - -(* reverse *) -nlet rec reverse_neList (T:Type) (nl:ne_list T) on nl ≝ - match nl with - [ ne_nil h ⇒ ne_nil T h - | ne_cons h t ⇒ (reverse_neList T t)&(ne_nil T h) - ]. - -(* getFirst *) -ndefinition get_first_neList ≝ -λT:Type.λnl:ne_list T.match nl with - [ ne_nil h ⇒ h - | ne_cons h _ ⇒ h ]. - -(* getLast *) -ndefinition get_last_neList ≝ -λT:Type.λnl:ne_list T.match reverse_neList T nl with - [ ne_nil h ⇒ h - | ne_cons h _ ⇒ h ]. - -(* cutFirst *) -ndefinition cut_first_neList ≝ -λT:Type.λnl:ne_list T.match nl with - [ ne_nil h ⇒ ne_nil T h - | ne_cons _ t ⇒ t ]. - -(* cutLast *) -ndefinition cut_last_neList ≝ -λT:Type.λnl:ne_list T.match reverse_neList T nl with - [ ne_nil h ⇒ ne_nil T h - | ne_cons _ t ⇒ reverse_neList T t ]. - -(* apply f *) -nlet rec apply_f_neList (T1,T2:Type) (nl:ne_list T1) (f:T1 → T2) on nl ≝ -match nl with - [ ne_nil h ⇒ ne_nil T2 (f h) - | ne_cons h t ⇒ ne_cons T2 (f h) (apply_f_neList T1 T2 t f) ]. - -(* fold right *) -nlet rec fold_right_neList (T1,T2:Type) (f:T1 → T2 → T2) (acc:T2) (nl:ne_list T1) on nl ≝ - match nl with - [ ne_nil h ⇒ f h acc - | ne_cons h t ⇒ f h (fold_right_neList T1 T2 f acc t) - ]. - -(* double fold right *) -nlemma fold_right_neList2_aux1 : -∀T.∀h,h',t'.len_neList T «£h» = len_neList T (h'§§t') → False. - #T; #h; #h'; #t'; - nnormalize; - ncases t'; - nnormalize; - ##[ ##1: #x; #H; ndestruct (*nelim (nat_destruct_0_S ? (nat_destruct_S_S … H))*) - ##| ##2: #x; #l; #H; ndestruct (*nelim (nat_destruct_0_S ? (nat_destruct_S_S … H))*) - ##] -nqed. - -nlemma fold_right_neList2_aux2 : -∀T.∀h,h',t.len_neList T (h§§t) = len_neList T «£h'» → False. - #T; #h; #h'; #t; - nnormalize; - ncases t; - nnormalize; - ##[ ##1: #x; #H; ndestruct (*nelim (nat_destruct_S_0 ? (nat_destruct_S_S … H))*) - ##| ##2: #x; #l; #H; ndestruct (*nelim (nat_destruct_S_0 ? (nat_destruct_S_S … H))*) - ##] -nqed. - -nlemma fold_right_neList2_aux3 : -∀T.∀h,h',t,t'.len_neList T (h§§t) = len_neList T (h'§§t') → len_neList T t = len_neList T t'. - #T; #h; #h'; #t; #t'; - nelim t; - nelim t'; - ##[ ##1: nnormalize; #x; #y; #H; napply refl_eq - ##| ##2: #a; #l'; #H; #x; #H1; - nchange in H1:(%) with ((S (len_neList T «£x»)) = (S (len_neList T (a§§l')))); - nrewrite > (nat_destruct_S_S … H1); - napply refl_eq - ##| ##3: #x; #a; #l'; #H; #H1; - nchange in H1:(%) with ((S (len_neList T (a§§l')))= (S (len_neList T «£x»))); - nrewrite > (nat_destruct_S_S … H1); - napply refl_eq - ##| ##4: #a; #l; #H; #a1; #l1; #H1; #H2; - nchange in H2:(%) with ((S (len_neList T (a1§§l1))) = (S (len_neList T (a§§l)))); - nrewrite > (nat_destruct_S_S … H2); - napply refl_eq - ##] -nqed. - -nlet rec fold_right_neList2 (T1,T2:Type) (f:T1 → T1 → T2 → T2) (acc:T2) (l1:ne_list T1) on l1 ≝ - match l1 - return λl1.Πl2.len_neList T1 l1 = len_neList T1 l2 → T2 - with - [ ne_nil h ⇒ λl2.match l2 return λl2.len_neList T1 «£h» = len_neList T1 l2 → T2 with - [ ne_nil h' ⇒ λp:len_neList T1 «£h» = len_neList T1 «£h'». - f h h' acc - | ne_cons h' t' ⇒ λp:len_neList T1 «£h» = len_neList T1 (h'§§t'). - False_rect_Type0 ? (fold_right_neList2_aux1 T1 h h' t' p) - ] - | ne_cons h t ⇒ λl2.match l2 return λl2.len_neList T1 (h§§t) = len_neList T1 l2 → T2 with - [ ne_nil h' ⇒ λp:len_neList T1 (h§§t) = len_neList T1 «£h'». - False_rect_Type0 ? (fold_right_neList2_aux2 T1 h h' t p) - | ne_cons h' t' ⇒ λp:len_neList T1 (h§§t) = len_neList T1 (h'§§t'). - f h h' (fold_right_neList2 T1 T2 f acc t t' (fold_right_neList2_aux3 T1 h h' t t' p)) - ] - ]. - -nlet rec bfold_right_neList2 (T1:Type) (f:T1 → T1 → bool) (l1,l2:ne_list T1) on l1 ≝ - match l1 with - [ ne_nil h ⇒ match l2 with - [ ne_nil h' ⇒ f h h' | ne_cons h' t' ⇒ false ] - | ne_cons h t ⇒ match l2 with - [ ne_nil h' ⇒ false | ne_cons h' t' ⇒ (f h h') ⊗ (bfold_right_neList2 T1 f t t') - ] - ]. - -(* nth elem *) -nlet rec nth_neList (T:Type) (nl:ne_list T) (n:nat) on nl ≝ - match nl with - [ ne_nil h ⇒ match n with - [ O ⇒ Some ? h | S _ ⇒ None ? ] - | ne_cons h t ⇒ match n with - [ O ⇒ Some ? h | S n' ⇒ nth_neList T t n' ] - ]. - -(* abs elem *) -ndefinition abs_neList_aux1 : ∀T:Type.∀h:T.∀n.((len_neList T («£h»)) > (S n)) = true → False. - #T; #h; #n; nnormalize; #H; ndestruct (*napply (bool_destruct … H)*). nqed. - -ndefinition abs_neList_aux2 : ∀T:Type.∀h:T.∀t:ne_list T.∀n.((len_neList T (h§§t)) > (S n) = true) → ((len_neList T t) > n) = true. - #T; #h; #t; #n; nnormalize; #H; napply H. nqed. - -nlet rec abs_neList (T:Type) (l:ne_list T) on l ≝ - match l - return λl.Πn.(((len_neList T l) > n) = true) → T - with - [ ne_nil h ⇒ λn. - match n - return λn.(((len_neList T (ne_nil T h)) > n) = true) → T - with - [ O ⇒ λp:(((len_neList T (ne_nil T h)) > O) = true).h - | S n' ⇒ λp:(((len_neList T (ne_nil T h)) > (S n')) = true). - False_rect_Type0 ? (abs_neList_aux1 T h n' p) - ] - | ne_cons h t ⇒ λn. - match n with - [ O ⇒ λp:(((len_neList T (ne_cons T h t)) > O) = true).h - | S n' ⇒ λp:(((len_neList T (ne_cons T h t)) > (S n')) = true). - abs_neList T t n' (abs_neList_aux2 T h t n' p) - ] - ]. - -(* esempio: abs_neList ? « 1; 2; 3 £ 4 » 0 (refl_eq …) = 0. *) - -(* conversione *) -nlet rec neList_to_list (T:Type) (nl:ne_list T) on nl : list T ≝ - match nl with [ ne_nil h ⇒ [h] | ne_cons h t ⇒ [h]@(neList_to_list T t) ]. diff --git a/helm/software/matita/contribs/ng_assembly/common/list_utility_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/list_utility_lemmas.ma deleted file mode 100755 index 971b10604..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/list_utility_lemmas.ma +++ /dev/null @@ -1,585 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/list_utility.ma". -include "common/list_lemmas.ma". - -(* *************** *) -(* LISTE GENERICHE *) -(* *************** *) - -nlemma symmetric_lenlist : ∀T.∀l1,l2:list T.len_list T l1 = len_list T l2 → len_list T l2 = len_list T l1. - #T; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; nnormalize; - ##[ ##1: #H; napply refl_eq - ##| ##2: #h; #t; #H; ndestruct (*nelim (nat_destruct_0_S ? H)*) - ##] - ##| ##2: #h; #l2; ncases l2; nnormalize; - ##[ ##1: #H; #l; #H1; nrewrite < H1; napply refl_eq - ##| ##2: #h; #l; #H; #l3; #H1; nrewrite < H1; napply refl_eq - ##] - ##] -nqed. - -nlemma symmetric_foldrightlist2_aux - : ∀T1,T2:Type.∀f:T1 → T1 → T2 → T2.∀acc:T2.∀l1,l2:list T1. - ∀H1:len_list T1 l1 = len_list T1 l2.∀H2:len_list T1 l2 = len_list T1 l1. - (∀x,y,z.f x y z = f y x z) → - fold_right_list2 T1 T2 f acc l1 l2 H1 = fold_right_list2 T1 T2 f acc l2 l1 H2. - #T1; #T2; #f; #acc; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: nnormalize; #H1; #H2; #H3; napply refl_eq - ##| ##2: #h; #l; #H1; #H2; #H3; - nchange in H1:(%) with (O = (S (len_list ? l))); - ndestruct (*nelim (nat_destruct_0_S ? H1)*) - ##] - ##| ##2: #h3; #l3; #H; #l2; ncases l2; - ##[ ##1: #H1; #H2; #H3; nchange in H1:(%) with ((S (len_list ? l3)) = O); - ndestruct (*nelim (nat_destruct_S_0 ? H1)*) - ##| ##2: #h4; #l4; #H1; #H2; #H3; - nchange in H1:(%) with ((S (len_list ? l3)) = (S (len_list ? l4))); - nchange in H2:(%) with ((S (len_list ? l4)) = (S (len_list ? l3))); - nchange with ((f h3 h4 (fold_right_list2 T1 T2 f acc l3 l4 (fold_right_list2_aux3 T1 h3 h4 l3 l4 ?))) = - (f h4 h3 (fold_right_list2 T1 T2 f acc l4 l3 (fold_right_list2_aux3 T1 h4 h3 l4 l3 ?)))); - nrewrite < (H l4 (fold_right_list2_aux3 T1 h3 h4 l3 l4 H1) (fold_right_list2_aux3 T1 h4 h3 l4 l3 H2) H3); - nrewrite > (H3 h3 h4 (fold_right_list2 T1 T2 f acc l3 l4 ?)); - napply refl_eq - ##] - ##] -nqed. - -nlemma symmetric_foldrightlist2 - : ∀T1,T2:Type.∀f:T1 → T1 → T2 → T2.∀acc:T2.∀l1,l2:list T1.∀H:len_list T1 l1 = len_list T1 l2. - (∀x,y,z.f x y z = f y x z) → - fold_right_list2 T1 T2 f acc l1 l2 H = fold_right_list2 T1 T2 f acc l2 l1 (symmetric_lenlist T1 l1 l2 H). - #T1; #T2; #f; #acc; #l1; #l2; #H; #H1; - nrewrite > (symmetric_foldrightlist2_aux T1 T2 f acc l1 l2 H (symmetric_lenlist T1 l1 l2 H) H1); - napply refl_eq. -nqed. - -nlemma symmetric_bfoldrightlist2 - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:list T1. - (∀x,y.f x y = f y x) → - bfold_right_list2 T1 f l1 l2 = bfold_right_list2 T1 f l2 l1. - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H; nnormalize; napply refl_eq - ##| ##2: #hh2; #ll2; #H; nnormalize; napply refl_eq - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #H1; nnormalize; napply refl_eq - ##| ##2: #hh2; #ll2; #H1; nnormalize; - nrewrite > (H ll2 H1); - nrewrite > (H1 hh1 hh2); - napply refl_eq - ##] - ##] -nqed. - -nlemma bfoldrightlist2_to_eq - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:list T1. - (∀x,y.(f x y = true → x = y)) → - (bfold_right_list2 T1 f l1 l2 = true → l1 = l2). - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H; #H1; napply refl_eq - ##| ##2: #hh2; #ll2; #H; nnormalize; #H1; - ndestruct (*napply (bool_destruct … H1)*) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #H1; nnormalize; #H2; - ndestruct (*napply (bool_destruct … H2)*) - ##| ##2: #hh2; #ll2; #H1; #H2; - nchange in H2:(%) with (((f hh1 hh2)⊗(bfold_right_list2 T f ll1 ll2)) = true); - nrewrite > (H1 hh1 hh2 (andb_true_true_l … H2)); - nrewrite > (H ll2 H1 (andb_true_true_r … H2)); - napply refl_eq - ##] - ##] -nqed. - -nlemma eq_to_bfoldrightlist2 - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:list T1. - (∀x,y.(x = y → f x y = true)) → - (l1 = l2 → bfold_right_list2 T1 f l1 l2 = true). - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H; #H1; nnormalize; napply refl_eq - ##| ##2: #hh2; #ll2; #H; #H1; - (* !!! ndestruct: assert false *) - nelim (list_destruct_nil_cons ??? H1) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #H1; #H2; - (* !!! ndestruct: assert false *) - nelim (list_destruct_cons_nil ??? H2) - ##| ##2: #hh2; #ll2; #H1; #H2; nnormalize; - nrewrite > (list_destruct_1 … H2); - nrewrite > (H1 hh2 hh2 (refl_eq …)); - nnormalize; - nrewrite > (H ll2 H1 (list_destruct_2 … H2)); - napply refl_eq - ##] - ##] -nqed. - -nlemma bfoldrightlist2_to_lenlist - : ∀T.∀f:T → T → bool.∀l1,l2:list T.bfold_right_list2 T f l1 l2 = true → len_list T l1 = len_list T l2. - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: nnormalize; #H; napply refl_eq - ##| ##2: nnormalize; #hh; #tt; #H; - ndestruct (*napply (bool_destruct … H)*) - ##] - ##| ##2: #hh; #tt; #H; #l2; ncases l2; - ##[ ##1: nnormalize; #H1; - ndestruct (*napply (bool_destruct … H1)*) - ##| ##2: #hh1; #tt1; #H1; nnormalize; - nrewrite > (H tt1 ?); - ##[ ##1: napply refl_eq - ##| ##2: nchange in H1:(%) with ((? ⊗ (bfold_right_list2 T f tt tt1)) = true); - napply (andb_true_true_r … H1) - ##] - ##] - ##] -nqed. - -nlemma decidable_list : ∀T.∀H:(Πx,y:T.decidable (x = y)).∀x,y:list T.decidable (x = y). - #T; #H; #x; nelim x; - ##[ ##1: #y; ncases y; - ##[ ##1: nnormalize; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##| ##2: #hh2; #tt2; nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H1; - (* !!! ndestruct: assert false *) - napply (list_destruct_nil_cons T … H1) - ##] - ##| ##2: #hh1; #tt1; #H1; #y; ncases y; - ##[ ##1: nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (list_destruct_cons_nil T … H2) - ##| ##2: #hh2; #tt2; nnormalize; napply (or2_elim (hh1 = hh2) (hh1 ≠ hh2) ? (H …)); - ##[ ##2: #H2; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H3; napply (H2 (list_destruct_1 T … H3)) - ##| ##1: #H2; napply (or2_elim (tt1 = tt2) (tt1 ≠ tt2) ? (H1 tt2)); - ##[ ##2: #H3; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H4; napply (H3 (list_destruct_2 T … H4)) - ##| ##1: #H3; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H2; nrewrite > H3; napply refl_eq - ##] - ##] - ##] - ##] -nqed. - -nlemma nbfoldrightlist2_to_neq - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:list T1. - (∀x,y.(f x y = false → x ≠ y)) → - (bfold_right_list2 T1 f l1 l2 = false → l1 ≠ l2). - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H; nnormalize; #H1; - ndestruct (*napply (bool_destruct … H1)*) - ##| ##2: #hh2; #ll2; #H; #H1; nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (list_destruct_nil_cons T … H2) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #H1; #H2; nnormalize; #H3; - (* !!! ndestruct: assert false *) - napply (list_destruct_cons_nil T … H3) - ##| ##2: #hh2; #ll2; #H1; #H2; nnormalize; #H3; - nchange in H2:(%) with (((f hh1 hh2)⊗(bfold_right_list2 T f ll1 ll2)) = false); - napply (H ll2 H1 ? (list_destruct_2 T … H3)); - napply (or2_elim ??? (andb_false2 … H2) ); - ##[ ##1: #H4; napply (absurd (hh1 = hh2) …); - ##[ ##1: nrewrite > (list_destruct_1 T … H3); napply refl_eq - ##| ##2: napply (H1 … H4) - ##] - ##| ##2: #H4; napply H4 - ##] - ##] - ##] -nqed. - -nlemma list_destruct - : ∀T.∀H:(Πx,y:T.decidable (x = y)).∀h1,h2:T.∀l1,l2:list T.(h1::l1) ≠ (h2::l2) → h1 ≠ h2 ∨ l1 ≠ l2. - #T; #H; #h1; #h2; #l1; nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H1; napply (or2_intro1 (h1 ≠ h2) ([] ≠ []) …); - nnormalize; #H2; nrewrite > H2 in H1:(%); - nnormalize; #H1; napply (H1 (refl_eq …)) - ##| ##2: #hh2; #ll2; #H1; napply (or2_intro2 (h1 ≠ h2) ([] ≠ (hh2::ll2)) …); - nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (list_destruct_nil_cons T … H2) - ##] - ##| ##2: #hh1; #ll1; #H1; #l2; ncases l2; - ##[ ##1: #H2; napply (or2_intro2 (h1 ≠ h2) ((hh1::ll1) ≠ []) …); - nnormalize; #H3; - (* !!! ndestruct: assert false *) - napply (list_destruct_cons_nil T … H3) - ##| ##2: #hh2; #ll2; #H2; - napply (or2_elim (h1 = h2) (h1 ≠ h2) ? (H h1 h2) …); - ##[ ##2: #H3; napply (or2_intro1 (h1 ≠ h2) ((hh1::ll1) ≠ (hh2::ll2)) H3) - ##| ##1: #H3; napply (or2_intro2 (h1 ≠ h2) ((hh1::ll1) ≠ (hh2::ll2) …)); - nrewrite > H3 in H2:(%); #H2; - nnormalize; #H4; nrewrite > (list_destruct_1 T … H4) in H2:(%); #H2; - nrewrite > (list_destruct_2 T … H4) in H2:(%); #H2; - napply (H2 (refl_eq …)) - ##] - ##] - ##] -nqed. - -nlemma neq_to_nbfoldrightlist2 - : ∀T:Type.∀f:T → T → bool.∀l1,l2:list T. - (∀x,y:T.decidable (x = y)) → - (∀x,y.(x ≠ y → f x y = false)) → - (l1 ≠ l2 → bfold_right_list2 T f l1 l2 = false). - #T; #f; #l1; - nelim l1; - ##[ ##1: #l2; ncases l2; - ##[ ##1: #H; #H1; nnormalize; #H2; nelim (H2 (refl_eq …)) - ##| ##2: #hh2; #ll2; #H; nnormalize; #H1; #H2; napply refl_eq - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #H1; #H2; nnormalize; #H3; napply refl_eq - ##| ##2: #hh2; #ll2; #H1; #H2; #H3; - nchange with (((f hh1 hh2)⊗(bfold_right_list2 T f ll1 ll2)) = false); - napply (or2_elim (hh1 ≠ hh2) (ll1 ≠ ll2) ? (list_destruct T H1 … H3) …); - ##[ ##1: #H4; nrewrite > (H2 hh1 hh2 H4); nnormalize; napply refl_eq - ##| ##2: #H4; nrewrite > (H ll2 H1 H2 H4); - nrewrite > (symmetric_andbool (f hh1 hh2) false); - nnormalize; napply refl_eq - ##] - ##] - ##] -nqed. - -nlemma isbemptylist_to_isemptylist : ∀T,l.isb_empty_list T l = true → is_empty_list T l. - #T; #l; - ncases l; - nnormalize; - ##[ ##1: #H; napply I - ##| ##2: #x; #l; #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma isnotbemptylist_to_isnotemptylist : ∀T,l.isnotb_empty_list T l = true → isnot_empty_list T l. - #T; #l; - ncases l; - nnormalize; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##2: #x; #l; #H; napply I - ##] -nqed. - -(* ************** *) -(* NON-EMPTY LIST *) -(* ************** *) - -nlemma symmetric_lennelist : ∀T.∀l1,l2:ne_list T.len_neList T l1 = len_neList T l2 → len_neList T l2 = len_neList T l1. - #T; #l1; - nelim l1; - ##[ ##1: #h; #l2; ncases l2; nnormalize; - ##[ ##1: #H; #H1; napply refl_eq - ##| ##2: #h; #t; #H; nrewrite > H; napply refl_eq - ##] - ##| ##2: #h; #l2; ncases l2; nnormalize; - ##[ ##1: #h1; #H; #l; #H1; nrewrite < H1; napply refl_eq - ##| ##2: #h; #l; #H; #l3; #H1; nrewrite < H1; napply refl_eq - ##] - ##] -nqed. - -nlemma symmetric_foldrightnelist2_aux - : ∀T1,T2:Type.∀f:T1 → T1 → T2 → T2.∀acc:T2.∀l1,l2:ne_list T1. - ∀H1:len_neList T1 l1 = len_neList T1 l2.∀H2:len_neList T1 l2 = len_neList T1 l1. - (∀x,y,z.f x y z = f y x z) → - fold_right_neList2 T1 T2 f acc l1 l2 H1 = fold_right_neList2 T1 T2 f acc l2 l1 H2. - #T1; #T2; #f; #acc; #l1; - nelim l1; - ##[ ##1: #h; #l2; ncases l2; - ##[ ##1: #h1; nnormalize; #H1; #H2; #H3; nrewrite > (H3 h h1 acc); napply refl_eq - ##| ##2: #h1; #l; ncases l; - ##[ ##1: #h3; #H1; #H2; #H3; - nchange in H1:(%) with ((S O) = (S (S O))); - (* !!! ndestruct: si inceppa su un'ipotesi che non e' H1 *) - nelim (nat_destruct_0_S ? (nat_destruct_S_S … H1)) - ##| ##2: #h3; #l3; #H1; #H2; #H3; - nchange in H1:(%) with ((S O) = (S (S (len_neList ? l3)))); - (* !!! ndestruct: si inceppa su un'ipotesi che non e' H1 *) - nelim (nat_destruct_0_S ? (nat_destruct_S_S … H1)) - ##] - ##] - ##| ##2: #h3; #l3; #H; #l2; ncases l2; - ##[ ##1: #h4; ncases l3; - ##[ ##1: #h5; #H1; #H2; #H3; - nchange in H1:(%) with ((S (S O)) = (S O)); - (* !!! ndestruct: si inceppa su un'ipotesi che non e' H1 *) - nelim (nat_destruct_S_0 ? (nat_destruct_S_S … H1)) - ##| ##2: #h5; #l5; #H1; #H2; #H3; - nchange in H1:(%) with ((S (S (len_neList ? l5))) = (S O)); - (* !!! ndestruct: si inceppa su un'ipotesi che non e' H1 *) - nelim (nat_destruct_S_0 ? (nat_destruct_S_S … H1)) - ##] - ##| ##2: #h4; #l4; #H1; #H2; #H3; - nchange in H1:(%) with ((S (len_neList ? l3)) = (S (len_neList ? l4))); - nchange in H2:(%) with ((S (len_neList ? l4)) = (S (len_neList ? l3))); - nchange with ((f h3 h4 (fold_right_neList2 T1 T2 f acc l3 l4 (fold_right_neList2_aux3 T1 h3 h4 l3 l4 ?))) = - (f h4 h3 (fold_right_neList2 T1 T2 f acc l4 l3 (fold_right_neList2_aux3 T1 h4 h3 l4 l3 ?)))); - nrewrite < (H l4 (fold_right_neList2_aux3 T1 h3 h4 l3 l4 H1) (fold_right_neList2_aux3 T1 h4 h3 l4 l3 H2) H3); - nrewrite > (H3 h3 h4 (fold_right_neList2 T1 T2 f acc l3 l4 ?)); - napply refl_eq - ##] - ##] -nqed. - -nlemma symmetric_foldrightnelist2 - : ∀T1,T2:Type.∀f:T1 → T1 → T2 → T2.∀acc:T2.∀l1,l2:ne_list T1.∀H:len_neList T1 l1 = len_neList T1 l2. - (∀x,y,z.f x y z = f y x z) → - fold_right_neList2 T1 T2 f acc l1 l2 H = fold_right_neList2 T1 T2 f acc l2 l1 (symmetric_lennelist T1 l1 l2 H). - #T1; #T2; #f; #acc; #l1; #l2; #H; #H1; - nrewrite > (symmetric_foldrightnelist2_aux T1 T2 f acc l1 l2 H (symmetric_lennelist T1 l1 l2 H) H1); - napply refl_eq. -nqed. - -nlemma symmetric_bfoldrightnelist2 - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:ne_list T1. - (∀x,y.f x y = f y x) → - bfold_right_neList2 T1 f l1 l2 = bfold_right_neList2 T1 f l2 l1. - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H; nnormalize; nrewrite > (H hh1 hh2); napply refl_eq - ##| ##2: #hh2; #ll2; #H; nnormalize; napply refl_eq - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #hh2; #H1; nnormalize; napply refl_eq - ##| ##2: #hh2; #ll2; #H1; nnormalize; - nrewrite > (H ll2 H1); - nrewrite > (H1 hh1 hh2); - napply refl_eq - ##] - ##] -nqed. - -nlemma bfoldrightnelist2_to_eq - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:ne_list T1. - (∀x,y.(f x y = true → x = y)) → - (bfold_right_neList2 T1 f l1 l2 = true → l1 = l2). - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H; #H1; nnormalize in H1:(%); nrewrite > (H hh1 hh2 H1); napply refl_eq - ##| ##2: #hh2; #ll2; #H; nnormalize; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #hh2; #H1; nnormalize; #H2; ndestruct (*napply (bool_destruct … H2)*) - ##| ##2: #hh2; #ll2; #H1; #H2; - nchange in H2:(%) with (((f hh1 hh2)⊗(bfold_right_neList2 T f ll1 ll2)) = true); - nrewrite > (H1 hh1 hh2 (andb_true_true_l … H2)); - nrewrite > (H ll2 H1 (andb_true_true_r … H2)); - napply refl_eq - ##] - ##] -nqed. - -nlemma eq_to_bfoldrightnelist2 - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:ne_list T1. - (∀x,y.(x = y → f x y = true)) → - (l1 = l2 → bfold_right_neList2 T1 f l1 l2 = true). - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H; #H1; nnormalize; - nrewrite > (H hh1 hh2 (nelist_destruct_nil_nil … H1)); - napply refl_eq - ##| ##2: #hh2; #ll2; #H; #H1; - (* !!! ndestruct: assert false *) - nelim (nelist_destruct_nil_cons ???? H1) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #hh2; #H1; #H2; - (* !!! ndestruct: assert false *) - nelim (nelist_destruct_cons_nil ???? H2) - ##| ##2: #hh2; #ll2; #H1; #H2; nnormalize; - nrewrite > (nelist_destruct_cons_cons_1 … H2); - nrewrite > (H1 hh2 hh2 (refl_eq …)); - nnormalize; - nrewrite > (H ll2 H1 (nelist_destruct_cons_cons_2 … H2)); - napply refl_eq - ##] - ##] -nqed. - -nlemma bfoldrightnelist2_to_lennelist - : ∀T.∀f:T → T → bool.∀l1,l2:ne_list T.bfold_right_neList2 T f l1 l2 = true → len_neList T l1 = len_neList T l2. - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: nnormalize; #hh2; #H; napply refl_eq - ##| ##2: nnormalize; #hh2; #tt2; #H; ndestruct (*napply (bool_destruct … H)*) - ##] - ##| ##2: #hh1; #tt1; #H; #l2; ncases l2; - ##[ ##1: nnormalize; #hh2; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##| ##2: #hh2; #tt2; #H1; nnormalize; - nrewrite > (H tt2 ?); - ##[ ##1: napply refl_eq - ##| ##2: nchange in H1:(%) with ((? ⊗ (bfold_right_neList2 T f tt1 tt2)) = true); - napply (andb_true_true_r … H1) - ##] - ##] - ##] -nqed. - -nlemma decidable_nelist : ∀T.∀H:(Πx,y:T.decidable (x = y)).∀x,y:ne_list T.decidable (x = y). - #T; #H; #x; nelim x; - ##[ ##1: #hh1; #y; ncases y; - ##[ ##1: #hh2; nnormalize; napply (or2_elim (hh1 = hh2) (hh1 ≠ hh2) ? (H hh1 hh2)); - ##[ ##1: #H1; nrewrite > H1; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##| ##2: #H1; napply (or2_intro2 (? = ?) (? ≠ ?) ?); nnormalize; - #H2; napply (H1 (nelist_destruct_nil_nil T … H2)) - ##] - ##| ##2: #hh2; #tt2; nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H1; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_nil_cons T … H1) - ##] - ##| ##2: #hh1; #tt1; #H1; #y; ncases y; - ##[ ##1: #hh1; nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_cons_nil T … H2) - ##| ##2: #hh2; #tt2; nnormalize; napply (or2_elim (hh1 = hh2) (hh1 ≠ hh2) ? (H …)); - ##[ ##2: #H2; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H3; napply (H2 (nelist_destruct_cons_cons_1 T … H3)) - ##| ##1: #H2; napply (or2_elim (tt1 = tt2) (tt1 ≠ tt2) ? (H1 tt2)); - ##[ ##2: #H3; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H4; napply (H3 (nelist_destruct_cons_cons_2 T … H4)) - ##| ##1: #H3; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H2; nrewrite > H3; napply refl_eq - ##] - ##] - ##] - ##] -nqed. - -nlemma nbfoldrightnelist2_to_neq - : ∀T1:Type.∀f:T1 → T1 → bool.∀l1,l2:ne_list T1. - (∀x,y.(f x y = false → x ≠ y)) → - (bfold_right_neList2 T1 f l1 l2 = false → l1 ≠ l2). - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H; nnormalize; #H1; #H2; napply (H hh1 hh2 H1 (nelist_destruct_nil_nil T … H2)) - ##| ##2: #hh2; #ll2; #H; #H1; nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_nil_cons T … H2) - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #hh2; #H1; #H2; nnormalize; #H3; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_cons_nil T … H3) - ##| ##2: #hh2; #ll2; #H1; #H2; nnormalize; #H3; - nchange in H2:(%) with (((f hh1 hh2)⊗(bfold_right_neList2 T f ll1 ll2)) = false); - napply (H ll2 H1 ? (nelist_destruct_cons_cons_2 T … H3)); - napply (or2_elim ??? (andb_false2 … H2) ); - ##[ ##1: #H4; napply (absurd (hh1 = hh2) …); - ##[ ##1: nrewrite > (nelist_destruct_cons_cons_1 T … H3); napply refl_eq - ##| ##2: napply (H1 … H4) - ##] - ##| ##2: #H4; napply H4 - ##] - ##] - ##] -nqed. - -nlemma nelist_destruct - : ∀T.∀H:(Πx,y:T.decidable (x = y)).∀h1,h2:T.∀l1,l2:ne_list T.(h1§§l1) ≠ (h2§§l2) → h1 ≠ h2 ∨ l1 ≠ l2. - #T; #H; #h1; #h2; #l1; nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H1; napply (or2_elim (h1 = h2) (h1 ≠ h2) ? (H …) …); - ##[ ##2: #H2; napply (or2_intro1 (h1 ≠ h2) («£hh1» ≠ «£hh2») H2) - ##| ##1: #H2; nrewrite > H2 in H1:(%); #H1; - napply (or2_elim (hh1 = hh2) (hh1 ≠ hh2) ? (H …) …); - ##[ ##2: #H3; napply (or2_intro2 (h2 ≠ h2) («£hh1» ≠ «£hh2») ?); - nnormalize; #H4; napply (H3 (nelist_destruct_nil_nil T … H4)) - ##| ##1: #H3; nrewrite > H3 in H1:(%); #H1; nelim (H1 (refl_eq …)) - ##] - ##] - ##| ##2: #hh2; #ll2; #H1; napply (or2_intro2 (h1 ≠ h2) («£hh1» ≠ (hh2§§ll2)) …); - nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_nil_cons T … H2) - ##] - ##| ##2: #hh1; #ll1; #H1; #l2; ncases l2; - ##[ ##1: #hh2; #H2; napply (or2_intro2 (h1 ≠ h2) ((hh1§§ll1) ≠ «£hh2») …); - nnormalize; #H3; - (* !!! ndestruct: assert false *) - napply (nelist_destruct_cons_nil T … H3) - ##| ##2: #hh2; #ll2; #H2; - napply (or2_elim (h1 = h2) (h1 ≠ h2) ? (H h1 h2) …); - ##[ ##2: #H3; napply (or2_intro1 (h1 ≠ h2) ((hh1§§ll1) ≠ (hh2§§ll2)) H3) - ##| ##1: #H3; napply (or2_intro2 (h1 ≠ h2) ((hh1§§ll1) ≠ (hh2§§ll2) …)); - nrewrite > H3 in H2:(%); #H2; - nnormalize; #H4; nrewrite > (nelist_destruct_cons_cons_1 T … H4) in H2:(%); #H2; - nrewrite > (nelist_destruct_cons_cons_2 T … H4) in H2:(%); #H2; - napply (H2 (refl_eq …)) - ##] - ##] - ##] -nqed. - -nlemma neq_to_nbfoldrightnelist2 - : ∀T:Type.∀f:T → T → bool.∀l1,l2:ne_list T. - (∀x,y:T.decidable (x = y)) → - (∀x,y.(x ≠ y → f x y = false)) → - (l1 ≠ l2 → bfold_right_neList2 T f l1 l2 = false). - #T; #f; #l1; - nelim l1; - ##[ ##1: #hh1; #l2; ncases l2; - ##[ ##1: #hh2; #H; #H1; nnormalize; #H2; napply (H1 hh1 hh2 ?); - nnormalize; #H3; nrewrite > H3 in H2:(%); #H2; napply (H2 (refl_eq …)) - ##| ##2: #hh2; #ll2; #H; nnormalize; #H1; #H2; napply refl_eq - ##] - ##| ##2: #hh1; #ll1; #H; #l2; ncases l2; - ##[ ##1: #hh2; #H1; #H2; nnormalize; #H3; napply refl_eq - ##| ##2: #hh2; #ll2; #H1; #H2; #H3; - nchange with (((f hh1 hh2)⊗(bfold_right_neList2 T f ll1 ll2)) = false); - napply (or2_elim (hh1 ≠ hh2) (ll1 ≠ ll2) ? (nelist_destruct T H1 … H3) …); - ##[ ##1: #H4; nrewrite > (H2 hh1 hh2 H4); nnormalize; napply refl_eq - ##| ##2: #H4; nrewrite > (H ll2 H1 H2 H4); - nrewrite > (symmetric_andbool (f hh1 hh2) false); - nnormalize; napply refl_eq - ##] - ##] - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/nat.ma b/helm/software/matita/contribs/ng_assembly/common/nat.ma deleted file mode 100755 index fe976cba6..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/nat.ma +++ /dev/null @@ -1,219 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ******** *) -(* NATURALI *) -(* ******** *) - -ninductive nat : Type ≝ - O : nat -| S : nat → nat. - -(* -interpretation "Natural numbers" 'N = nat. - -default "natural numbers" cic:/matita/common/nat/nat.ind. - -alias num (instance 0) = "natural number". -*) - -ndefinition nat1 ≝ S O. -ndefinition nat2 ≝ S nat1. -ndefinition nat3 ≝ S nat2. -ndefinition nat4 ≝ S nat3. -ndefinition nat5 ≝ S nat4. -ndefinition nat6 ≝ S nat5. -ndefinition nat7 ≝ S nat6. -ndefinition nat8 ≝ S nat7. -ndefinition nat9 ≝ S nat8. -ndefinition nat10 ≝ S nat9. -ndefinition nat11 ≝ S nat10. -ndefinition nat12 ≝ S nat11. -ndefinition nat13 ≝ S nat12. -ndefinition nat14 ≝ S nat13. -ndefinition nat15 ≝ S nat14. -ndefinition nat16 ≝ S nat15. -ndefinition nat17 ≝ S nat16. -ndefinition nat18 ≝ S nat17. -ndefinition nat19 ≝ S nat18. -ndefinition nat20 ≝ S nat19. -ndefinition nat21 ≝ S nat20. -ndefinition nat22 ≝ S nat21. -ndefinition nat23 ≝ S nat22. -ndefinition nat24 ≝ S nat23. -ndefinition nat25 ≝ S nat24. -ndefinition nat26 ≝ S nat25. -ndefinition nat27 ≝ S nat26. -ndefinition nat28 ≝ S nat27. -ndefinition nat29 ≝ S nat28. -ndefinition nat30 ≝ S nat29. -ndefinition nat31 ≝ S nat30. -ndefinition nat32 ≝ S nat31. -ndefinition nat33 ≝ S nat32. -ndefinition nat34 ≝ S nat33. -ndefinition nat35 ≝ S nat34. -ndefinition nat36 ≝ S nat35. -ndefinition nat37 ≝ S nat36. -ndefinition nat38 ≝ S nat37. -ndefinition nat39 ≝ S nat38. -ndefinition nat40 ≝ S nat39. -ndefinition nat41 ≝ S nat40. -ndefinition nat42 ≝ S nat41. -ndefinition nat43 ≝ S nat42. -ndefinition nat44 ≝ S nat43. -ndefinition nat45 ≝ S nat44. -ndefinition nat46 ≝ S nat45. -ndefinition nat47 ≝ S nat46. -ndefinition nat48 ≝ S nat47. -ndefinition nat49 ≝ S nat48. -ndefinition nat50 ≝ S nat49. -ndefinition nat51 ≝ S nat50. -ndefinition nat52 ≝ S nat51. -ndefinition nat53 ≝ S nat52. -ndefinition nat54 ≝ S nat53. -ndefinition nat55 ≝ S nat54. -ndefinition nat56 ≝ S nat55. -ndefinition nat57 ≝ S nat56. -ndefinition nat58 ≝ S nat57. -ndefinition nat59 ≝ S nat58. -ndefinition nat60 ≝ S nat59. -ndefinition nat61 ≝ S nat60. -ndefinition nat62 ≝ S nat61. -ndefinition nat63 ≝ S nat62. -ndefinition nat64 ≝ S nat63. -ndefinition nat65 ≝ S nat64. -ndefinition nat66 ≝ S nat65. -ndefinition nat67 ≝ S nat66. -ndefinition nat68 ≝ S nat67. -ndefinition nat69 ≝ S nat68. -ndefinition nat70 ≝ S nat69. -ndefinition nat71 ≝ S nat70. -ndefinition nat72 ≝ S nat71. -ndefinition nat73 ≝ S nat72. -ndefinition nat74 ≝ S nat73. -ndefinition nat75 ≝ S nat74. -ndefinition nat76 ≝ S nat75. -ndefinition nat77 ≝ S nat76. -ndefinition nat78 ≝ S nat77. -ndefinition nat79 ≝ S nat78. -ndefinition nat80 ≝ S nat79. -ndefinition nat81 ≝ S nat80. -ndefinition nat82 ≝ S nat81. -ndefinition nat83 ≝ S nat82. -ndefinition nat84 ≝ S nat83. -ndefinition nat85 ≝ S nat84. -ndefinition nat86 ≝ S nat85. -ndefinition nat87 ≝ S nat86. -ndefinition nat88 ≝ S nat87. -ndefinition nat89 ≝ S nat88. -ndefinition nat90 ≝ S nat89. -ndefinition nat91 ≝ S nat90. -ndefinition nat92 ≝ S nat91. -ndefinition nat93 ≝ S nat92. -ndefinition nat94 ≝ S nat93. -ndefinition nat95 ≝ S nat94. -ndefinition nat96 ≝ S nat95. -ndefinition nat97 ≝ S nat96. -ndefinition nat98 ≝ S nat97. -ndefinition nat99 ≝ S nat98. -ndefinition nat100 ≝ S nat99. - -nlet rec eq_nat (n1,n2:nat) on n1 ≝ - match n1 with - [ O ⇒ match n2 with [ O ⇒ true | S _ ⇒ false ] - | S n1' ⇒ match n2 with [ O ⇒ false | S n2' ⇒ eq_nat n1' n2' ] - ]. - -nlet rec le_nat n m ≝ - match n with - [ O ⇒ true - | (S p) ⇒ match m with - [ O ⇒ false | (S q) ⇒ le_nat p q ] - ]. - -interpretation "natural 'less or equal to'" 'leq x y = (le_nat x y). - -ndefinition lt_nat ≝ λn1,n2:nat.(le_nat n1 n2) ⊗ (⊖ (eq_nat n1 n2)). - -interpretation "natural 'less than'" 'lt x y = (lt_nat x y). - -ndefinition ge_nat ≝ λn1,n2:nat.(⊖ (le_nat n1 n2)) ⊕ (eq_nat n1 n2). - -interpretation "natural 'greater or equal to'" 'geq x y = (ge_nat x y). - -ndefinition gt_nat ≝ λn1,n2:nat.⊖ (le_nat n1 n2). - -interpretation "natural 'greater than'" 'gt x y = (gt_nat x y). - -nlet rec plus (n1,n2:nat) on n1 ≝ - match n1 with - [ O ⇒ n2 - | (S n1') ⇒ S (plus n1' n2) ]. - -interpretation "natural plus" 'plus x y = (plus x y). - -nlet rec times (n1,n2:nat) on n1 ≝ - match n1 with - [ O ⇒ O - | (S n1') ⇒ n2 + (times n1' n2) ]. - -interpretation "natural times" 'times x y = (times x y). - -nlet rec minus n m ≝ - match n with - [ O ⇒ O - | (S p) ⇒ - match m with - [O ⇒ (S p) - | (S q) ⇒ minus p q ]]. - -interpretation "natural minus" 'minus x y = (minus x y). - -nlet rec div_aux p m n : nat ≝ -match (le_nat m n) with -[ true ⇒ O -| false ⇒ - match p with - [ O ⇒ O - | (S q) ⇒ S (div_aux q (m-(S n)) n)]]. - -ndefinition div : nat → nat → nat ≝ -λn,m.match m with - [ O ⇒ S n - | (S p) ⇒ div_aux n n p]. - -interpretation "natural divide" 'divide x y = (div x y). - -ndefinition pred ≝ λn.match n with [ O ⇒ O | S n ⇒ n ]. - -ndefinition nat128 ≝ nat64 * nat2. -ndefinition nat256 ≝ nat128 * nat2. -ndefinition nat512 ≝ nat256 * nat2. -ndefinition nat1024 ≝ nat512 * nat2. -ndefinition nat2048 ≝ nat1024 * nat2. -ndefinition nat4096 ≝ nat2048 * nat2. -ndefinition nat8192 ≝ nat4096 * nat2. -ndefinition nat16384 ≝ nat8192 * nat2. -ndefinition nat32768 ≝ nat16384 * nat2. -ndefinition nat65536 ≝ nat32768 * nat2. diff --git a/helm/software/matita/contribs/ng_assembly/common/nat_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/nat_lemmas.ma deleted file mode 100644 index 06ace91b2..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/nat_lemmas.ma +++ /dev/null @@ -1,176 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/nat.ma". -include "num/bool_lemmas.ma". - -(* ******** *) -(* NATURALI *) -(* ******** *) - -nlemma nat_destruct_S_S : ∀n1,n2:nat.S n1 = S n2 → n1 = n2. - #n1; #n2; #H; - nchange with (match S n2 with [ O ⇒ False | S a ⇒ n1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -(* !!! da togliere *) -nlemma nat_destruct_0_S : ∀n:nat.O = S n → False. - #n; #H; - nchange with (match S n with [ O ⇒ True | S a ⇒ False ]); - nrewrite < H; - nnormalize; - napply I. -nqed. - -(* !!! da togliere *) -nlemma nat_destruct_S_0 : ∀n:nat.S n = O → False. - #n; #H; - nchange with (match S n with [ O ⇒ True | S a ⇒ False ]); - nrewrite > H; - nnormalize; - napply I. -nqed. - -nlemma eq_to_eqnat : ∀n1,n2:nat.n1 = n2 → eq_nat n1 n2 = true. - #n1; - nelim n1; - ##[ ##1: #n2; - nelim n2; - nnormalize; - ##[ ##1: #H; napply refl_eq - ##| ##2: #n3; #H; #H1; ndestruct (*nelim (nat_destruct_0_S ? H1)*) - ##] - ##| ##2: #n2; #H; #n3; #H1; - ncases n3 in H1:(%) ⊢ %; - nnormalize; - ##[ ##1: #H1; ndestruct (*nelim (nat_destruct_S_0 ? H1)*) - ##| ##2: #n4; #H1; - napply (H n4 (nat_destruct_S_S … H1)) - ##] - ##] -nqed. - -nlemma neqnat_to_neq : ∀n1,n2:nat.(eq_nat n1 n2 = false → n1 ≠ n2). - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_nat n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqnat n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqnat_to_eq : ∀n1,n2:nat.(eq_nat n1 n2 = true → n1 = n2). - #n1; - nelim n1; - ##[ ##1: #n2; - nelim n2; - nnormalize; - ##[ ##1: #H; napply refl_eq - ##| ##2: #n3; #H; #H1; ndestruct (*napply (bool_destruct … (O = S n3) H1)*) - ##] - ##| ##2: #n2; #H; #n3; #H1; - ncases n3 in H1:(%) ⊢ %; - nnormalize; - ##[ ##1: #H1; ndestruct (*napply (bool_destruct … (S n2 = O) H1)*) - ##| ##2: #n4; #H1; - nrewrite > (H n4 H1); - napply refl_eq - ##] - ##] -nqed. - -nlemma neq_to_neqnat : ∀n1,n2:nat.n1 ≠ n2 → eq_nat n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_nat n1 n2)); - napply (not_to_not (eq_nat n1 n2 = true) (n1 = n2) ? H); - napply (eqnat_to_eq n1 n2). -nqed. - -nlemma decidable_nat : ∀x,y:nat.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_nat x y = true) (eq_nat x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqnat_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqnat_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqnat : symmetricT nat bool eq_nat. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_nat n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqnat n1 n2 H); - napply (symmetric_eq ? (eq_nat n2 n1) false); - napply (neq_to_neqnat n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. - -nlemma Sn_p_n_to_S_npn : ∀n1,n2.(S n1) + n2 = S (n1 + n2). - #n1; - nelim n1; - ##[ ##1: nnormalize; #n2; napply refl_eq - ##| ##2: #n; #H; #n2; nrewrite > (H n2); - ncases n in H:(%) ⊢ %; - ##[ ##1: nnormalize; #H; napply refl_eq - ##| ##2: #n3; nnormalize; #H; napply refl_eq - ##] - ##] -nqed. - -nlemma n_p_Sn_to_S_npn : ∀n1,n2.n1 + (S n2) = S (n1 + n2). - #n1; - nelim n1; - ##[ ##1: nnormalize; #n2; napply refl_eq - ##| ##2: #n; #H; #n2; - nrewrite > (Sn_p_n_to_S_npn n (S n2)); - nrewrite > (H n2); - napply refl_eq - ##] -nqed. - -nlemma Opn_to_n : ∀n.O + n = n. - #n; nnormalize; napply refl_eq. -nqed. - -nlemma npO_to_n : ∀n.n + O = n. - #n; - nelim n; - ##[ ##1: nnormalize; napply refl_eq - ##| ##2: #n1; #H; - nrewrite > (Sn_p_n_to_S_npn n1 O); - nrewrite > H; - napply refl_eq - ##] -nqed. - -nlemma symmetric_plusnat : symmetricT nat nat plus. - #n1; - nelim n1; - ##[ ##1: #n2; nrewrite > (npO_to_n n2); nnormalize; napply refl_eq - ##| ##2: #n2; #H; #n3; - nrewrite > (Sn_p_n_to_S_npn n2 n3); - nrewrite > (n_p_Sn_to_S_npn n3 n2); - nrewrite > (H n3); - napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/nat_to_num.ma b/helm/software/matita/contribs/ng_assembly/common/nat_to_num.ma deleted file mode 100755 index 6bd7fc4ae..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/nat_to_num.ma +++ /dev/null @@ -1,78 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/nat.ma". -include "num/word32.ma". - -(* ************************ *) -(* NUMERI FINITI → NATURALI *) -(* ************************ *) - -nlet rec nat_of_qu_aux n (r:rec_quatern n) on r ≝ - match r with - [ qu_O ⇒ O - | qu_S t n' ⇒ S (nat_of_qu_aux t n') - ]. - -ndefinition nat_of_qu : quatern → nat ≝ λn.nat_of_qu_aux n (qu_to_recqu n). - -nlet rec nat_of_oct_aux n (r:rec_oct n) on r ≝ - match r with - [ oc_O ⇒ O - | oc_S t n' ⇒ S (nat_of_oct_aux t n') - ]. - -ndefinition nat_of_oct : oct → nat ≝ λn.nat_of_oct_aux n (oct_to_recoct n). - -nlet rec nat_of_ex_aux n (r:rec_exadecim n) on r ≝ - match r with - [ ex_O ⇒ O - | ex_S t n' ⇒ S (nat_of_ex_aux t n') - ]. - -ndefinition nat_of_ex : exadecim → nat ≝ λn.nat_of_ex_aux n (ex_to_recex n). - -nlet rec nat_of_bit_aux n (r:rec_bitrigesim n) on r ≝ - match r with - [ bi_O ⇒ O - | bi_S t n' ⇒ S (nat_of_bit_aux t n') - ]. - -ndefinition nat_of_bit : bitrigesim → nat ≝ λn.nat_of_bit_aux n (bit_to_recbit n). - -nlet rec nat_of_b8_aux n (r:rec_byte8 n) on r ≝ - match r with - [ b8_O ⇒ O - | b8_S t n' ⇒ S (nat_of_b8_aux t n') - ]. - -ndefinition nat_of_b8 : byte8 → nat ≝ λn:byte8.nat_of_b8_aux n (b8_to_recb8 n). - -nlet rec nat_of_w16_aux n (r:rec_word16 n) on r : nat ≝ - match r with - [ w16_O ⇒ O - | w16_S t n' ⇒ S (nat_of_w16_aux t n') - ]. - -ndefinition nat_of_w16 : word16 → nat ≝ λn:word16.nat_of_w16_aux n (w16_to_recw16 n). - -ndefinition nat_of_w32 : word32 → nat ≝ λn:word32.(nat65536 * (nat_of_w16 (w32h n))) + (nat_of_w16 (w32l n)). diff --git a/helm/software/matita/contribs/ng_assembly/common/option.ma b/helm/software/matita/contribs/ng_assembly/common/option.ma deleted file mode 100644 index 244f087f3..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/option.ma +++ /dev/null @@ -1,43 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ****** *) -(* OPTION *) -(* ****** *) - -ninductive option (A:Type) : Type ≝ - None : option A -| Some : A → option A. - -ndefinition eq_option ≝ -λT.λop1,op2:option T.λf:T → T → bool. - match op1 with - [ None ⇒ match op2 with [ None ⇒ true | Some _ ⇒ false ] - | Some x1 ⇒ match op2 with [ None ⇒ false | Some x2 ⇒ f x1 x2 ] - ]. - -(* option map = match ... with [ None ⇒ None ? | Some .. ⇒ .. ] *) -ndefinition opt_map ≝ -λT1,T2:Type.λt:option T1.λf:T1 → option T2. - match t with [ None ⇒ None ? | Some x ⇒ (f x) ]. diff --git a/helm/software/matita/contribs/ng_assembly/common/option_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/option_lemmas.ma deleted file mode 100644 index 144733fe9..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/option_lemmas.ma +++ /dev/null @@ -1,172 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/option.ma". -include "num/bool_lemmas.ma". - -(* ****** *) -(* OPTION *) -(* ****** *) - -nlemma option_destruct_some_some : ∀T.∀x1,x2:T.Some T x1 = Some T x2 → x1 = x2. - #T; #x1; #x2; #H; - nchange with (match Some T x2 with [ None ⇒ False | Some a ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -(* !!! da togliere *) -nlemma option_destruct_some_none : ∀T.∀x:T.Some T x = None T → False. - #T; #x; #H; - nchange with (match Some T x with [ None ⇒ True | Some a ⇒ False ]); - nrewrite > H; - nnormalize; - napply I. -nqed. - -(* !!! da togliere *) -nlemma option_destruct_none_some : ∀T.∀x:T.None T = Some T x → False. - #T; #x; #H; - nchange with (match Some T x with [ None ⇒ True | Some a ⇒ False ]); - nrewrite < H; - nnormalize; - napply I. -nqed. - -nlemma symmetric_eqoption : -∀T:Type.∀op1,op2:option T.∀f:T → T → bool. - (symmetricT T bool f) → - (eq_option T op1 op2 f = eq_option T op2 op1 f). - #T; #op1; #op2; #f; #H; - nelim op1; - nelim op2; - nnormalize; - ##[ ##1: napply refl_eq - ##| ##2,3: #H; napply refl_eq - ##| ##4: #a; #a0; - nrewrite > (H a0 a); - napply refl_eq - ##] -nqed. - -nlemma eq_to_eqoption : -∀T.∀op1,op2:option T.∀f:T → T → bool. - (∀x1,x2:T.x1 = x2 → f x1 x2 = true) → - (op1 = op2 → eq_option T op1 op2 f = true). - #T; #op1; #op2; #f; #H; - nelim op1; - nelim op2; - nnormalize; - ##[ ##1: #H1; napply refl_eq - ##| ##2: #a; #H1; - (* !!! ndestruct: assert false *) - nelim (option_destruct_none_some ?? H1) - ##| ##3: #a; #H1; - (* !!! ndestruct: assert false *) - nelim (option_destruct_some_none ?? H1) - ##| ##4: #a; #a0; #H1; - nrewrite > (H … (option_destruct_some_some … H1)); - napply refl_eq - ##] -nqed. - -nlemma eqoption_to_eq : -∀T.∀op1,op2:option T.∀f:T → T → bool. - (∀x1,x2:T.f x1 x2 = true → x1 = x2) → - (eq_option T op1 op2 f = true → op1 = op2). - #T; #op1; #op2; #f; #H; - nelim op1; - nelim op2; - nnormalize; - ##[ ##1: #H1; napply refl_eq - ##| ##2,3: #a; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##| ##4: #a; #a0; #H1; - nrewrite > (H … H1); - napply refl_eq - ##] -nqed. - -nlemma decidable_option : ∀T.∀H:(Πx,y:T.decidable (x = y)).∀x,y:option T.decidable (x = y). - #T; #H; #x; nelim x; - ##[ ##1: #y; ncases y; - ##[ ##1: nnormalize; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##| ##2: #yy; nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H1; - (* !!! ndestruct: assert false *) - napply (option_destruct_none_some T … H1) - ##] - ##| ##2: #xx; #y; ncases y; - ##[ ##1: nnormalize; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H2; - (* !!! ndestruct: assert false *) - napply (option_destruct_some_none T … H2) - ##| ##2: #yy; nnormalize; napply (or2_elim (xx = yy) (xx ≠ yy) ? (H …)); - ##[ ##2: #H1; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H2; - napply (H1 (option_destruct_some_some T … H2)) - ##| ##1: #H1; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H1; napply refl_eq - ##] - ##] - ##] -nqed. - -nlemma neq_to_neqoption : -∀T.∀op1,op2:option T.∀f:T → T → bool. - (∀x1,x2:T.x1 ≠ x2 → f x1 x2 = false) → - (op1 ≠ op2 → eq_option T op1 op2 f = false). - #T; #op1; nelim op1; - ##[ ##1: #op2; ncases op2; - ##[ ##1: nnormalize; #f; #H; #H1; nelim (H1 (refl_eq …)) - ##| ##2: #yy; #f; #H; nnormalize; #H1; napply refl_eq - ##] - ##| ##2: #xx; #op2; ncases op2; - ##[ ##1: #f; #H; nnormalize; #H1; napply refl_eq - ##| ##2: #yy; #f; #H; nnormalize; #H1; napply (H xx yy …); - nnormalize; #H2; nrewrite > H2 in H1:(%); #H1; - napply (H1 (refl_eq …)) - ##] - ##] -nqed. - -nlemma neqoption_to_neq : -∀T.∀op1,op2:option T.∀f:T → T → bool. - (∀x1,x2:T.f x1 x2 = false → x1 ≠ x2) → - (eq_option T op1 op2 f = false → op1 ≠ op2). - #T; #op1; nelim op1; - ##[ ##1: #op2; ncases op2; - ##[ ##1: nnormalize; #f; #H; #H1; - ndestruct (*napply (bool_destruct … H1)*) - ##| ##2: #yy; #f; #H; nnormalize; #H1; #H2; - (* !!! ndestruct: assert false *) - napply (option_destruct_none_some T … H2) - ##] - ##| ##2: #xx; #op2; ncases op2; - ##[ ##1: nnormalize; #f; #H; #H1; #H2; - (* !!! ndestruct: assert false *) - napply (option_destruct_some_none T … H2) - ##| ##2: #yy; #f; #H; nnormalize; #H1; #H2; napply (H xx yy H1 ?); - napply (option_destruct_some_some T … H2) - ##] - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/prod.ma b/helm/software/matita/contribs/ng_assembly/common/prod.ma deleted file mode 100644 index fca58bc22..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/prod.ma +++ /dev/null @@ -1,111 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ***** *) -(* TUPLE *) -(* ***** *) - -ninductive ProdT (T1:Type) (T2:Type) : Type ≝ - pair : T1 → T2 → ProdT T1 T2. - -ndefinition fst ≝ -λT1,T2:Type.λp:ProdT T1 T2.match p with [ pair x _ ⇒ x ]. - -ndefinition snd ≝ -λT1,T2:Type.λp:ProdT T1 T2.match p with [ pair _ x ⇒ x ]. - -ndefinition eq_pair ≝ -λT1,T2:Type.λp1,p2:ProdT T1 T2. -λf1:T1 → T1 → bool.λf2:T2 → T2 → bool. - (f1 (fst … p1) (fst … p2)) ⊗ - (f2 (snd … p1) (snd … p2)). - -ninductive Prod3T (T1:Type) (T2:Type) (T3:Type) : Type ≝ -triple : T1 → T2 → T3 → Prod3T T1 T2 T3. - -ndefinition fst3T ≝ -λT1.λT2.λT3.λp:Prod3T T1 T2 T3.match p with [ triple x _ _ ⇒ x ]. - -ndefinition snd3T ≝ -λT1.λT2.λT3.λp:Prod3T T1 T2 T3.match p with [ triple _ x _ ⇒ x ]. - -ndefinition thd3T ≝ -λT1.λT2.λT3.λp:Prod3T T1 T2 T3.match p with [ triple _ _ x ⇒ x ]. - -ndefinition eq_triple ≝ -λT1,T2,T3:Type.λp1,p2:Prod3T T1 T2 T3. -λf1:T1 → T1 → bool.λf2:T2 → T2 → bool.λf3:T3 → T3 → bool. - (f1 (fst3T … p1) (fst3T … p2)) ⊗ - (f2 (snd3T … p1) (snd3T … p2)) ⊗ - (f3 (thd3T … p1) (thd3T … p2)). - -ninductive Prod4T (T1:Type) (T2:Type) (T3:Type) (T4:Type) : Type ≝ -quadruple : T1 → T2 → T3 → T4 → Prod4T T1 T2 T3 T4. - -ndefinition fst4T ≝ -λT1.λT2.λT3.λT4.λp:Prod4T T1 T2 T3 T4.match p with [ quadruple x _ _ _ ⇒ x ]. - -ndefinition snd4T ≝ -λT1.λT2.λT3.λT4.λp:Prod4T T1 T2 T3 T4.match p with [ quadruple _ x _ _ ⇒ x ]. - -ndefinition thd4T ≝ -λT1.λT2.λT3.λT4.λp:Prod4T T1 T2 T3 T4.match p with [ quadruple _ _ x _ ⇒ x ]. - -ndefinition fth4T ≝ -λT1.λT2.λT3.λT4.λp:Prod4T T1 T2 T3 T4.match p with [ quadruple _ _ _ x ⇒ x ]. - -ndefinition eq_quadruple ≝ -λT1,T2,T3,T4:Type.λp1,p2:Prod4T T1 T2 T3 T4. -λf1:T1 → T1 → bool.λf2:T2 → T2 → bool.λf3:T3 → T3 → bool.λf4:T4 → T4 → bool. - (f1 (fst4T … p1) (fst4T … p2)) ⊗ - (f2 (snd4T … p1) (snd4T … p2)) ⊗ - (f3 (thd4T … p1) (thd4T … p2)) ⊗ - (f4 (fth4T … p1) (fth4T … p2)). - -ninductive Prod5T (T1:Type) (T2:Type) (T3:Type) (T4:Type) (T5:Type) : Type ≝ -quintuple : T1 → T2 → T3 → T4 → T5 → Prod5T T1 T2 T3 T4 T5. - -ndefinition fst5T ≝ -λT1.λT2.λT3.λT4.λT5.λp:Prod5T T1 T2 T3 T4 T5.match p with [ quintuple x _ _ _ _ ⇒ x ]. - -ndefinition snd5T ≝ -λT1.λT2.λT3.λT4.λT5.λp:Prod5T T1 T2 T3 T4 T5.match p with [ quintuple _ x _ _ _ ⇒ x ]. - -ndefinition thd5T ≝ -λT1.λT2.λT3.λT4.λT5.λp:Prod5T T1 T2 T3 T4 T5.match p with [ quintuple _ _ x _ _ ⇒ x ]. - -ndefinition fth5T ≝ -λT1.λT2.λT3.λT4.λT5.λp:Prod5T T1 T2 T3 T4 T5.match p with [ quintuple _ _ _ x _ ⇒ x ]. - -ndefinition fft5T ≝ -λT1.λT2.λT3.λT4.λT5.λp:Prod5T T1 T2 T3 T4 T5.match p with [ quintuple _ _ _ _ x ⇒ x ]. - -ndefinition eq_quintuple ≝ -λT1,T2,T3,T4,T5:Type.λp1,p2:Prod5T T1 T2 T3 T4 T5. -λf1:T1 → T1 → bool.λf2:T2 → T2 → bool.λf3:T3 → T3 → bool.λf4:T4 → T4 → bool.λf5:T5 → T5 → bool. - (f1 (fst5T … p1) (fst5T … p2)) ⊗ - (f2 (snd5T … p1) (snd5T … p2)) ⊗ - (f3 (thd5T … p1) (thd5T … p2)) ⊗ - (f4 (fth5T … p1) (fth5T … p2)) ⊗ - (f5 (fft5T … p1) (fft5T … p2)). diff --git a/helm/software/matita/contribs/ng_assembly/common/prod_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/prod_lemmas.ma deleted file mode 100644 index 29998a836..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/prod_lemmas.ma +++ /dev/null @@ -1,930 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/prod.ma". -include "num/bool_lemmas.ma". - -(* ********* *) -(* TUPLE x 2 *) -(* ********* *) - -nlemma pair_destruct_1 : -∀T1,T2.∀x1,x2:T1.∀y1,y2:T2. - pair T1 T2 x1 y1 = pair T1 T2 x2 y2 → x1 = x2. - #T1; #T2; #x1; #x2; #y1; #y2; #H; - nchange with (match pair T1 T2 x2 y2 with [ pair a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma pair_destruct_2 : -∀T1,T2.∀x1,x2:T1.∀y1,y2:T2. - pair T1 T2 x1 y1 = pair T1 T2 x2 y2 → y1 = y2. - #T1; #T2; #x1; #x2; #y1; #y2; #H; - nchange with (match pair T1 T2 x2 y2 with [ pair _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqpair : -∀T1,T2:Type.∀p1,p2:ProdT T1 T2. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool. - (symmetricT T1 bool f1) → - (symmetricT T2 bool f2) → - (eq_pair T1 T2 p1 p2 f1 f2 = eq_pair T1 T2 p2 p1 f1 f2). - #T1; #T2; #p1; #p2; #f1; #f2; #H; #H1; - nelim p1; - #x1; #y1; - nelim p2; - #x2; #y2; - nnormalize; - nrewrite > (H x1 x2); - ncases (f1 x2 x1); - nnormalize; - ##[ ##1: nrewrite > (H1 y1 y2); napply refl_eq - ##| ##2: napply refl_eq - ##] -nqed. - -nlemma eq_to_eqpair : -∀T1,T2.∀p1,p2:ProdT T1 T2. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool. - (∀x,y:T1.x = y → f1 x y = true) → - (∀x,y:T2.x = y → f2 x y = true) → - (p1 = p2 → eq_pair T1 T2 p1 p2 f1 f2 = true). - #T1; #T2; #p1; #p2; #f1; #f2; #H1; #H2; - nelim p1; - #x1; #y1; - nelim p2; - #x2; #y2; #H; - nnormalize; - nrewrite > (H1 … (pair_destruct_1 … H)); - nnormalize; - nrewrite > (H2 … (pair_destruct_2 … H)); - napply refl_eq. -nqed. - -nlemma eqpair_to_eq : -∀T1,T2.∀p1,p2:ProdT T1 T2. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool. - (∀x,y:T1.f1 x y = true → x = y) → - (∀x,y:T2.f2 x y = true → x = y) → - (eq_pair T1 T2 p1 p2 f1 f2 = true → p1 = p2). - #T1; #T2; #p1; #p2; #f1; #f2; #H1; #H2; - nelim p1; - #x1; #y1; - nelim p2; - #x2; #y2; #H; - nnormalize in H:(%); - nletin K ≝ (H1 x1 x2); - ncases (f1 x1 x2) in H:(%) K:(%); - nnormalize; - #H3; - ##[ ##2: ndestruct (*napply (bool_destruct … H3)*) ##] - #H4; - nrewrite > (H4 (refl_eq …)); - nrewrite > (H2 y1 y2 H3); - napply refl_eq. -nqed. - -nlemma decidable_pair - : ∀T1,T2. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - ∀x,y:ProdT T1 T2.decidable (x = y). - #T1; #T2; #H; #H1; - #x; nelim x; #xx1; #xx2; - #y; nelim y; #yy1; #yy2; - nnormalize; - napply (or2_elim (xx1 = yy1) (xx1 ≠ yy1) ? (H xx1 yy1) ?); - ##[ ##2: #H2; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H3; napply (H2 (pair_destruct_1 T1 T2 … H3)) - ##| ##1: #H2; napply (or2_elim (xx2 = yy2) (xx2 ≠ yy2) ? (H1 xx2 yy2) ?); - ##[ ##2: #H3; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H4; napply (H3 (pair_destruct_2 T1 T2 … H4)) - ##| ##1: #H3; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H2; nrewrite > H3; napply refl_eq - ##] - ##] -nqed. - -nlemma neqpair_to_neq : - ∀T1,T2.∀p1,p2:ProdT T1 T2. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool. - (∀x,y:T1.f1 x y = false → x ≠ y) → - (∀x,y:T2.f2 x y = false → x ≠ y) → - (eq_pair T1 T2 p1 p2 f1 f2 = false → p1 ≠ p2). - #T1; #T2; #p1; #p2; #f1; #f2; #H1; #H2; - nelim p1; - #x1; #y1; - nelim p2; - #x2; #y2; - nchange with ((((f1 x1 x2) ⊗ (f2 y1 y2)) = false) → ?); #H; - nnormalize; #H3; - napply (or2_elim ((f1 x1 x2) = false) ((f2 y1 y2) = false) ? (andb_false2 … H) ?); - ##[ ##1: #H4; napply (H1 x1 x2 H4); napply (pair_destruct_1 T1 T2 … H3) - ##| ##2: #H4; napply (H2 y1 y2 H4); napply (pair_destruct_2 T1 T2 … H3) - ##] -nqed. - -nlemma pair_destruct - : ∀T1,T2. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - ∀x1,x2:T1.∀y1,y2:T2.(pair T1 T2 x1 y1) ≠ (pair T1 T2 x2 y2) → x1 ≠ x2 ∨ y1 ≠ y2. - #T1; #T2; #H1; #H2; #x1; #x2; #y1; #y2; - nnormalize; #H; - napply (or2_elim (x1 = x2) (x1 ≠ x2) ? (H1 x1 x2) ?); - ##[ ##2: #H3; napply (or2_intro1 … H3) - ##| ##1: #H3; napply (or2_elim (y1 = y2) (y1 ≠ y2) ? (H2 y1 y2) ?); - ##[ ##2: #H4; napply (or2_intro2 … H4) - ##| ##1: #H4; nrewrite > H3 in H:(%); - nrewrite > H4; #H; nelim (H (refl_eq …)) - ##] - ##] -nqed. - -nlemma neq_to_neqpair : - ∀T1,T2.∀p1,p2:ProdT T1 T2. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T1.x ≠ y → f1 x y = false) → - (∀x,y:T2.x ≠ y → f2 x y = false) → - (p1 ≠ p2 → eq_pair T1 T2 p1 p2 f1 f2 = false). - #T1; #T2; #p1; #p2; #f1; #f2; #H1; #H2; #H3; #H4; - nelim p1; - #x1; #y1; - nelim p2; - #x2; #y2; #H; - nchange with (((f1 x1 x2) ⊗ (f2 y1 y2)) = false); - napply (or2_elim (x1 ≠ x2) (y1 ≠ y2) ? (pair_destruct T1 T2 H1 H2 … H) ?); - ##[ ##2: #H5; nrewrite > (H4 … H5); nrewrite > (andb_false2_2 (f1 x1 x2)); napply refl_eq - ##| ##1: #H5; nrewrite > (H3 … H5); nnormalize; napply refl_eq - ##] -nqed. - -(* ********* *) -(* TUPLE x 3 *) -(* ********* *) - -nlemma triple_destruct_1 : -∀T1,T2,T3.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3. - triple T1 T2 T3 x1 y1 z1 = triple T1 T2 T3 x2 y2 z2 → x1 = x2. - #T1; #T2; #T3; #x1; #x2; #y1; #y2; #z1; #z2; #H; - nchange with (match triple T1 T2 T3 x2 y2 z2 with [ triple a _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma triple_destruct_2 : -∀T1,T2,T3.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3. - triple T1 T2 T3 x1 y1 z1 = triple T1 T2 T3 x2 y2 z2 → y1 = y2. - #T1; #T2; #T3; #x1; #x2; #y1; #y2; #z1; #z2; #H; - nchange with (match triple T1 T2 T3 x2 y2 z2 with [ triple _ b _ ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma triple_destruct_3 : -∀T1,T2,T3.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3. - triple T1 T2 T3 x1 y1 z1 = triple T1 T2 T3 x2 y2 z2 → z1 = z2. - #T1; #T2; #T3; #x1; #x2; #y1; #y2; #z1; #z2; #H; - nchange with (match triple T1 T2 T3 x2 y2 z2 with [ triple _ _ c ⇒ z1 = c ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqtriple : -∀T1,T2,T3:Type.∀p1,p2:Prod3T T1 T2 T3. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool. - (symmetricT T1 bool f1) → - (symmetricT T2 bool f2) → - (symmetricT T3 bool f3) → - (eq_triple T1 T2 T3 p1 p2 f1 f2 f3 = eq_triple T1 T2 T3 p2 p1 f1 f2 f3). - #T1; #T2; #T3; #p1; #p2; #f1; #f2; #f3; #H; #H1; #H2; - nelim p1; - #x1; #y1; #z1; - nelim p2; - #x2; #y2; #z2; - nnormalize; - nrewrite > (H x1 x2); - ncases (f1 x2 x1); - nnormalize; - ##[ ##1: nrewrite > (H1 y1 y2); - ncases (f2 y2 y1); - nnormalize; - ##[ ##1: nrewrite > (H2 z1 z2); napply refl_eq - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] -nqed. - -nlemma eq_to_eqtriple : -∀T1,T2,T3.∀p1,p2:Prod3T T1 T2 T3. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool. - (∀x1,x2:T1.x1 = x2 → f1 x1 x2 = true) → - (∀y1,y2:T2.y1 = y2 → f2 y1 y2 = true) → - (∀z1,z2:T3.z1 = z2 → f3 z1 z2 = true) → - (p1 = p2 → eq_triple T1 T2 T3 p1 p2 f1 f2 f3 = true). - #T1; #T2; #T3; #p1; #p2; #f1; #f2; #f3; #H1; #H2; #H3; - nelim p1; - #x1; #y1; #z1; - nelim p2; - #x2; #y2; #z2; #H; - nnormalize; - nrewrite > (H1 … (triple_destruct_1 … H)); - nnormalize; - nrewrite > (H2 … (triple_destruct_2 … H)); - nnormalize; - nrewrite > (H3 … (triple_destruct_3 … H)); - napply refl_eq. -nqed. - -nlemma eqtriple_to_eq : -∀T1,T2,T3.∀p1,p2:Prod3T T1 T2 T3. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool. - (∀x1,x2:T1.f1 x1 x2 = true → x1 = x2) → - (∀y1,y2:T2.f2 y1 y2 = true → y1 = y2) → - (∀z1,z2:T3.f3 z1 z2 = true → z1 = z2) → - (eq_triple T1 T2 T3 p1 p2 f1 f2 f3 = true → p1 = p2). - #T1; #T2; #T3; #p1; #p2; #f1; #f2; #f3; #H1; #H2; #H3; - nelim p1; - #x1; #y1; #z1; - nelim p2; - #x2; #y2; #z2; #H; - nnormalize in H:(%); - nletin K ≝ (H1 x1 x2); - ncases (f1 x1 x2) in H:(%) K:(%); - nnormalize; - ##[ ##2: #H4; ndestruct (*napply (bool_destruct … H4)*) ##] - nletin K1 ≝ (H2 y1 y2); - ncases (f2 y1 y2) in K1:(%) ⊢ %; - nnormalize; - ##[ ##2: #H4; #H5; ndestruct (*napply (bool_destruct … H5)*) ##] - #H4; #H5; #H6; - nrewrite > (H4 (refl_eq …)); - nrewrite > (H6 (refl_eq …)); - nrewrite > (H3 z1 z2 H5); - napply refl_eq. -nqed. - -nlemma decidable_triple - : ∀T1,T2,T3. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - ∀x,y:Prod3T T1 T2 T3.decidable (x = y). - #T1; #T2; #T3; #H; #H1; #H2; - #x; nelim x; #xx1; #xx2; #xx3; - #y; nelim y; #yy1; #yy2; #yy3; - nnormalize; - napply (or2_elim (xx1 = yy1) (xx1 ≠ yy1) ? (H xx1 yy1) ?); - ##[ ##2: #H3; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H4; napply (H3 (triple_destruct_1 T1 T2 T3 … H4)) - ##| ##1: #H3; napply (or2_elim (xx2 = yy2) (xx2 ≠ yy2) ? (H1 xx2 yy2) ?); - ##[ ##2: #H4; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H5; napply (H4 (triple_destruct_2 T1 T2 T3 … H5)) - ##| ##1: #H4; napply (or2_elim (xx3 = yy3) (xx3 ≠ yy3) ? (H2 xx3 yy3) ?); - ##[ ##2: #H5; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H6; napply (H5 (triple_destruct_3 T1 T2 T3 … H6)) - ##| ##1: #H5; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H3; - nrewrite > H4; - nrewrite > H5; - napply refl_eq - ##] - ##] - ##] -nqed. - -nlemma neqtriple_to_neq : - ∀T1,T2,T3.∀p1,p2:Prod3T T1 T2 T3. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool. - (∀x,y:T1.f1 x y = false → x ≠ y) → - (∀x,y:T2.f2 x y = false → x ≠ y) → - (∀x,y:T3.f3 x y = false → x ≠ y) → - (eq_triple T1 T2 T3 p1 p2 f1 f2 f3 = false → p1 ≠ p2). - #T1; #T2; #T3; #p1; #p2; #f1; #f2; #f3; #H1; #H2; #H3; - nelim p1; - #x1; #y1; #z1; - nelim p2; - #x2; #y2; #z2; - nchange with ((((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2)) = false) → ?); #H; - nnormalize; #H4; - napply (or3_elim ((f1 x1 x2) = false) ((f2 y1 y2) = false) ((f3 z1 z2) = false) ? (andb_false3 … H) ?); - ##[ ##1: #H5; napply (H1 x1 x2 H5); napply (triple_destruct_1 T1 T2 T3 … H4) - ##| ##2: #H5; napply (H2 y1 y2 H5); napply (triple_destruct_2 T1 T2 T3 … H4) - ##| ##3: #H5; napply (H3 z1 z2 H5); napply (triple_destruct_3 T1 T2 T3 … H4) - ##] -nqed. - -nlemma triple_destruct - : ∀T1,T2,T3. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - ∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.(triple T1 T2 T3 x1 y1 z1) ≠ (triple T1 T2 T3 x2 y2 z2) → - Or3 (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2). - #T1; #T2; #T3; #H1; #H2; #H3; #x1; #x2; #y1; #y2; #z1; #z2; - nnormalize; #H; - napply (or2_elim (x1 = x2) (x1 ≠ x2) ? (H1 x1 x2) ?); - ##[ ##2: #H4; napply (or3_intro1 … H4) - ##| ##1: #H4; napply (or2_elim (y1 = y2) (y1 ≠ y2) ? (H2 y1 y2) ?); - ##[ ##2: #H5; napply (or3_intro2 … H5) - ##| ##1: #H5; napply (or2_elim (z1 = z2) (z1 ≠ z2) ? (H3 z1 z2) ?); - ##[ ##2: #H6; napply (or3_intro3 … H6) - ##| ##1: #H6; nrewrite > H4 in H:(%); - nrewrite > H5; - nrewrite > H6; #H; nelim (H (refl_eq …)) - ##] - ##] - ##] -nqed. - -nlemma neq_to_neqtriple : - ∀T1,T2,T3.∀p1,p2:Prod3T T1 T2 T3. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T1.x ≠ y → f1 x y = false) → - (∀x,y:T2.x ≠ y → f2 x y = false) → - (∀x,y:T3.x ≠ y → f3 x y = false) → - (p1 ≠ p2 → eq_triple T1 T2 T3 p1 p2 f1 f2 f3 = false). - #T1; #T2; #T3; #p1; #p2; #f1; #f2; #f3; #H1; #H2; #H3; #H4; #H5; #H6; - nelim p1; - #x1; #y1; #z1; - nelim p2; - #x2; #y2; #z2; #H; - nchange with (((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2)) = false); - napply (or3_elim (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2) ? (triple_destruct T1 T2 T3 H1 H2 H3 … H) ?); - ##[ ##1: #H7; nrewrite > (H4 … H7); nrewrite > (andb_false3_1 (f2 y1 y2) (f3 z1 z2)); napply refl_eq - ##| ##2: #H7; nrewrite > (H5 … H7); nrewrite > (andb_false3_2 (f1 x1 x2) (f3 z1 z2)); napply refl_eq - ##| ##3: #H7; nrewrite > (H6 … H7); nrewrite > (andb_false3_3 (f1 x1 x2) (f2 y1 y2)); napply refl_eq - ##] -nqed. - -(* ********* *) -(* TUPLE x 4 *) -(* ********* *) - -nlemma quadruple_destruct_1 : -∀T1,T2,T3,T4.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4. - quadruple T1 T2 T3 T4 x1 y1 z1 v1 = quadruple T1 T2 T3 T4 x2 y2 z2 v2 → x1 = x2. - #T1; #T2; #T3; #T4; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #H; - nchange with (match quadruple T1 T2 T3 T4 x2 y2 z2 v2 with [ quadruple a _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quadruple_destruct_2 : -∀T1,T2,T3,T4.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4. - quadruple T1 T2 T3 T4 x1 y1 z1 v1 = quadruple T1 T2 T3 T4 x2 y2 z2 v2 → y1 = y2. - #T1; #T2; #T3; #T4; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #H; - nchange with (match quadruple T1 T2 T3 T4 x2 y2 z2 v2 with [ quadruple _ b _ _ ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quadruple_destruct_3 : -∀T1,T2,T3,T4.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4. - quadruple T1 T2 T3 T4 x1 y1 z1 v1 = quadruple T1 T2 T3 T4 x2 y2 z2 v2 → z1 = z2. - #T1; #T2; #T3; #T4; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #H; - nchange with (match quadruple T1 T2 T3 T4 x2 y2 z2 v2 with [ quadruple _ _ c _ ⇒ z1 = c ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quadruple_destruct_4 : -∀T1,T2,T3,T4.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4. - quadruple T1 T2 T3 T4 x1 y1 z1 v1 = quadruple T1 T2 T3 T4 x2 y2 z2 v2 → v1 = v2. - #T1; #T2; #T3; #T4; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #H; - nchange with (match quadruple T1 T2 T3 T4 x2 y2 z2 v2 with [ quadruple _ _ _ d ⇒ v1 = d ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqquadruple : -∀T1,T2,T3,T4:Type.∀p1,p2:Prod4T T1 T2 T3 T4. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool. - (symmetricT T1 bool f1) → - (symmetricT T2 bool f2) → - (symmetricT T3 bool f3) → - (symmetricT T4 bool f4) → - (eq_quadruple T1 T2 T3 T4 p1 p2 f1 f2 f3 f4 = eq_quadruple T1 T2 T3 T4 p2 p1 f1 f2 f3 f4). - #T1; #T2; #T3; #T4; #p1; #p2; #f1; #f2; #f3; #f4; #H; #H1; #H2; #H3; - nelim p1; - #x1; #y1; #z1; #v1; - nelim p2; - #x2; #y2; #z2; #v2; - nnormalize; - nrewrite > (H x1 x2); - ncases (f1 x2 x1); - nnormalize; - ##[ ##1: nrewrite > (H1 y1 y2); - ncases (f2 y2 y1); - nnormalize; - ##[ ##1: nrewrite > (H2 z1 z2); - ncases (f3 z2 z1); - nnormalize; - ##[ ##1: nrewrite > (H3 v1 v2); napply refl_eq - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] -nqed. - -nlemma eq_to_eqquadruple : -∀T1,T2,T3,T4.∀p1,p2:Prod4T T1 T2 T3 T4. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool. - (∀x,y:T1.x = y → f1 x y = true) → - (∀x,y:T2.x = y → f2 x y = true) → - (∀x,y:T3.x = y → f3 x y = true) → - (∀x,y:T4.x = y → f4 x y = true) → - (p1 = p2 → eq_quadruple T1 T2 T3 T4 p1 p2 f1 f2 f3 f4 = true). - #T1; #T2; #T3; #T4; #p1; #p2; #f1; #f2; #f3; #f4; #H1; #H2; #H3; #H4; - nelim p1; - #x1; #y1; #z1; #v1; - nelim p2; - #x2; #y2; #z2; #v2; #H; - nnormalize; - nrewrite > (H1 … (quadruple_destruct_1 … H)); - nnormalize; - nrewrite > (H2 … (quadruple_destruct_2 … H)); - nnormalize; - nrewrite > (H3 … (quadruple_destruct_3 … H)); - nnormalize; - nrewrite > (H4 … (quadruple_destruct_4 … H)); - napply refl_eq. -nqed. - -nlemma eqquadruple_to_eq : -∀T1,T2,T3,T4.∀p1,p2:Prod4T T1 T2 T3 T4. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool. - (∀x,y:T1.f1 x y = true → x = y) → - (∀x,y:T2.f2 x y = true → x = y) → - (∀x,y:T3.f3 x y = true → x = y) → - (∀x,y:T4.f4 x y = true → x = y) → - (eq_quadruple T1 T2 T3 T4 p1 p2 f1 f2 f3 f4 = true → p1 = p2). - #T1; #T2; #T3; #T4; #p1; #p2; #f1; #f2; #f3; #f4; #H1; #H2; #H3; #H4; - nelim p1; - #x1; #y1; #z1; #v1; - nelim p2; - #x2; #y2; #z2; #v2; #H; - nnormalize in H:(%); - nletin K ≝ (H1 x1 x2); - ncases (f1 x1 x2) in H:(%) K:(%); - nnormalize; - ##[ ##2: #H5; ndestruct (*napply (bool_destruct … H5)*) ##] - nletin K1 ≝ (H2 y1 y2); - ncases (f2 y1 y2) in K1:(%) ⊢ %; - nnormalize; - ##[ ##2: #H5; #H6; ndestruct (*napply (bool_destruct … H6)*) ##] - nletin K2 ≝ (H3 z1 z2); - ncases (f3 z1 z2) in K2:(%) ⊢ %; - nnormalize; - ##[ ##2: #H5; #H6; #H7; ndestruct (*napply (bool_destruct … H7)*) ##] - #H5; #H6; #H7; #H8; - nrewrite > (H5 (refl_eq …)); - nrewrite > (H6 (refl_eq …)); - nrewrite > (H8 (refl_eq …)); - nrewrite > (H4 v1 v2 H7); - napply refl_eq. -nqed. - -nlemma decidable_quadruple - : ∀T1,T2,T3,T4. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - ∀x,y:Prod4T T1 T2 T3 T4.decidable (x = y). - #T1; #T2; #T3; #T4; #H; #H1; #H2; #H3; - #x; nelim x; #xx1; #xx2; #xx3; #xx4; - #y; nelim y; #yy1; #yy2; #yy3; #yy4; - nnormalize; - napply (or2_elim (xx1 = yy1) (xx1 ≠ yy1) ? (H xx1 yy1) ?); - ##[ ##2: #H4; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H5; napply (H4 (quadruple_destruct_1 T1 T2 T3 T4 … H5)) - ##| ##1: #H4; napply (or2_elim (xx2 = yy2) (xx2 ≠ yy2) ? (H1 xx2 yy2) ?); - ##[ ##2: #H5; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H6; napply (H5 (quadruple_destruct_2 T1 T2 T3 T4 … H6)) - ##| ##1: #H5; napply (or2_elim (xx3 = yy3) (xx3 ≠ yy3) ? (H2 xx3 yy3) ?); - ##[ ##2: #H6; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H7; napply (H6 (quadruple_destruct_3 T1 T2 T3 T4 … H7)) - ##| ##1: #H6; napply (or2_elim (xx4 = yy4) (xx4 ≠ yy4) ? (H3 xx4 yy4) ?); - ##[ ##2: #H7; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H8; napply (H7 (quadruple_destruct_4 T1 T2 T3 T4 … H8)) - ##| ##1: #H7; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H4; - nrewrite > H5; - nrewrite > H6; - nrewrite > H7; - napply refl_eq - ##] - ##] - ##] - ##] -nqed. - -nlemma neqquadruple_to_neq : - ∀T1,T2,T3,T4.∀p1,p2:Prod4T T1 T2 T3 T4. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool. - (∀x,y:T1.f1 x y = false → x ≠ y) → - (∀x,y:T2.f2 x y = false → x ≠ y) → - (∀x,y:T3.f3 x y = false → x ≠ y) → - (∀x,y:T4.f4 x y = false → x ≠ y) → - (eq_quadruple T1 T2 T3 T4 p1 p2 f1 f2 f3 f4 = false → p1 ≠ p2). - #T1; #T2; #T3; #T4; #p1; #p2; #f1; #f2; #f3; #f4; #H1; #H2; #H3; #H4; - nelim p1; - #x1; #y1; #z1; #v1; - nelim p2; - #x2; #y2; #z2; #v2; - nchange with ((((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2) ⊗ (f4 v1 v2)) = false) → ?); #H; - nnormalize; #H5; - napply (or4_elim ((f1 x1 x2) = false) ((f2 y1 y2) = false) ((f3 z1 z2) = false) ((f4 v1 v2) = false) ? (andb_false4 … H) ?); - ##[ ##1: #H6; napply (H1 x1 x2 H6); napply (quadruple_destruct_1 T1 T2 T3 T4 … H5) - ##| ##2: #H6; napply (H2 y1 y2 H6); napply (quadruple_destruct_2 T1 T2 T3 T4 … H5) - ##| ##3: #H6; napply (H3 z1 z2 H6); napply (quadruple_destruct_3 T1 T2 T3 T4 … H5) - ##| ##4: #H6; napply (H4 v1 v2 H6); napply (quadruple_destruct_4 T1 T2 T3 T4 … H5) - ##] -nqed. - -nlemma quadruple_destruct - : ∀T1,T2,T3,T4. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - ∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4. - (quadruple T1 T2 T3 T4 x1 y1 z1 v1) ≠ (quadruple T1 T2 T3 T4 x2 y2 z2 v2) → - Or4 (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2) (v1 ≠ v2). - #T1; #T2; #T3; #T4; #H1; #H2; #H3; #H4; - #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; - nnormalize; #H; - napply (or2_elim (x1 = x2) (x1 ≠ x2) ? (H1 x1 x2) ?); - ##[ ##2: #H5; napply (or4_intro1 … H5) - ##| ##1: #H5; napply (or2_elim (y1 = y2) (y1 ≠ y2) ? (H2 y1 y2) ?); - ##[ ##2: #H6; napply (or4_intro2 … H6) - ##| ##1: #H6; napply (or2_elim (z1 = z2) (z1 ≠ z2) ? (H3 z1 z2) ?); - ##[ ##2: #H7; napply (or4_intro3 … H7) - ##| ##1: #H7; napply (or2_elim (v1 = v2) (v1 ≠ v2) ? (H4 v1 v2) ?); - ##[ ##2: #H8; napply (or4_intro4 … H8) - ##| ##1: #H8; nrewrite > H5 in H:(%); - nrewrite > H6; - nrewrite > H7; - nrewrite > H8; #H; nelim (H (refl_eq …)) - ##] - ##] - ##] - ##] -nqed. - -nlemma neq_to_neqquadruple : - ∀T1,T2,T3,T4.∀p1,p2:Prod4T T1 T2 T3 T4. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - (∀x,y:T1.x ≠ y → f1 x y = false) → - (∀x,y:T2.x ≠ y → f2 x y = false) → - (∀x,y:T3.x ≠ y → f3 x y = false) → - (∀x,y:T4.x ≠ y → f4 x y = false) → - (p1 ≠ p2 → eq_quadruple T1 T2 T3 T4 p1 p2 f1 f2 f3 f4 = false). - #T1; #T2; #T3; #T4; #p1; #p2; #f1; #f2; #f3; #f4; #H1; #H2; #H3; #H4; #H5; #H6; #H7; #H8; - nelim p1; - #x1; #y1; #z1; #v1; - nelim p2; - #x2; #y2; #z2; #v2; #H; - nchange with (((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2) ⊗ (f4 v1 v2)) = false); - napply (or4_elim (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2) (v1 ≠ v2) ? (quadruple_destruct T1 T2 T3 T4 H1 H2 H3 H4 … H) ?); - ##[ ##1: #H9; nrewrite > (H5 … H9); nrewrite > (andb_false4_1 (f2 y1 y2) (f3 z1 z2) (f4 v1 v2)); napply refl_eq - ##| ##2: #H9; nrewrite > (H6 … H9); nrewrite > (andb_false4_2 (f1 x1 x2) (f3 z1 z2) (f4 v1 v2)); napply refl_eq - ##| ##3: #H9; nrewrite > (H7 … H9); nrewrite > (andb_false4_3 (f1 x1 x2) (f2 y1 y2) (f4 v1 v2)); napply refl_eq - ##| ##4: #H9; nrewrite > (H8 … H9); nrewrite > (andb_false4_4 (f1 x1 x2) (f2 y1 y2) (f3 z1 z2)); napply refl_eq - ##] -nqed. - -(* ********* *) -(* TUPLE x 5 *) -(* ********* *) - -nlemma quintuple_destruct_1 : -∀T1,T2,T3,T4,T5.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1 = quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 → x1 = x2. - #T1; #T2; #T3; #T4; #T5; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; #H; - nchange with (match quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 with [ quintuple a _ _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quintuple_destruct_2 : -∀T1,T2,T3,T4,T5.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1 = quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 → y1 = y2. - #T1; #T2; #T3; #T4; #T5; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; #H; - nchange with (match quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 with [ quintuple _ b _ _ _ ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quintuple_destruct_3 : -∀T1,T2,T3,T4,T5.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1 = quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 → z1 = z2. - #T1; #T2; #T3; #T4; #T5; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; #H; - nchange with (match quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 with [ quintuple _ _ c _ _ ⇒ z1 = c ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quintuple_destruct_4 : -∀T1,T2,T3,T4,T5.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1 = quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 → v1 = v2. - #T1; #T2; #T3; #T4; #T5; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; #H; - nchange with (match quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 with [ quintuple _ _ _ d _ ⇒ v1 = d ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma quintuple_destruct_5 : -∀T1,T2,T3,T4,T5.∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1 = quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 → w1 = w2. - #T1; #T2; #T3; #T4; #T5; #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; #H; - nchange with (match quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2 with [ quintuple _ _ _ _ e ⇒ w1 = e ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqquintuple : -∀T1,T2,T3,T4,T5:Type.∀p1,p2:Prod5T T1 T2 T3 T4 T5. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool.∀f5:T5 → T5 → bool. - (symmetricT T1 bool f1) → - (symmetricT T2 bool f2) → - (symmetricT T3 bool f3) → - (symmetricT T4 bool f4) → - (symmetricT T5 bool f5) → - (eq_quintuple T1 T2 T3 T4 T5 p1 p2 f1 f2 f3 f4 f5 = eq_quintuple T1 T2 T3 T4 T5 p2 p1 f1 f2 f3 f4 f5). - #T1; #T2; #T3; #T4; #T5; #p1; #p2; #f1; #f2; #f3; #f4; #f5; #H; #H1; #H2; #H3; #H4; - nelim p1; - #x1; #y1; #z1; #v1; #w1; - nelim p2; - #x2; #y2; #z2; #v2; #w2; - nnormalize; - nrewrite > (H x1 x2); - ncases (f1 x2 x1); - nnormalize; - ##[ ##1: nrewrite > (H1 y1 y2); - ncases (f2 y2 y1); - nnormalize; - ##[ ##1: nrewrite > (H2 z1 z2); - ncases (f3 z2 z1); - nnormalize; - ##[ ##1: nrewrite > (H3 v1 v2); - ncases (f4 v2 v1); - nnormalize; - ##[ ##1: nrewrite > (H4 w1 w2); napply refl_eq - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] - ##| ##2: napply refl_eq - ##] -nqed. - -nlemma eq_to_eqquintuple : -∀T1,T2,T3,T4,T5.∀p1,p2:Prod5T T1 T2 T3 T4 T5. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool.∀f5:T5 → T5 → bool. - (∀x,y:T1.x = y → f1 x y = true) → - (∀x,y:T2.x = y → f2 x y = true) → - (∀x,y:T3.x = y → f3 x y = true) → - (∀x,y:T4.x = y → f4 x y = true) → - (∀x,y:T5.x = y → f5 x y = true) → - (p1 = p2 → eq_quintuple T1 T2 T3 T4 T5 p1 p2 f1 f2 f3 f4 f5 = true). - #T1; #T2; #T3; #T4; #T5; #p1; #p2; #f1; #f2; #f3; #f4; #f5; #H1; #H2; #H3; #H4; #H5; - nelim p1; - #x1; #y1; #z1; #v1; #w1; - nelim p2; - #x2; #y2; #z2; #v2; #w2; #H; - nnormalize; - nrewrite > (H1 … (quintuple_destruct_1 … H)); - nnormalize; - nrewrite > (H2 … (quintuple_destruct_2 … H)); - nnormalize; - nrewrite > (H3 … (quintuple_destruct_3 … H)); - nnormalize; - nrewrite > (H4 … (quintuple_destruct_4 … H)); - nnormalize; - nrewrite > (H5 … (quintuple_destruct_5 … H)); - napply refl_eq. -nqed. - -nlemma eqquintuple_to_eq : -∀T1,T2,T3,T4,T5.∀p1,p2:Prod5T T1 T2 T3 T4 T5. -∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool.∀f5:T5 → T5 → bool. - (∀x,y:T1.f1 x y = true → x = y) → - (∀x,y:T2.f2 x y = true → x = y) → - (∀x,y:T3.f3 x y = true → x = y) → - (∀x,y:T4.f4 x y = true → x = y) → - (∀x,y:T5.f5 x y = true → x = y) → - (eq_quintuple T1 T2 T3 T4 T5 p1 p2 f1 f2 f3 f4 f5 = true → p1 = p2). - #T1; #T2; #T3; #T4; #T5; #p1; #p2; #f1; #f2; #f3; #f4; #f5; #H1; #H2; #H3; #H4; #H5; - nelim p1; - #x1; #y1; #z1; #v1; #w1; - nelim p2; - #x2; #y2; #z2; #v2; #w2; #H; - nnormalize in H:(%); - nletin K ≝ (H1 x1 x2); - ncases (f1 x1 x2) in H:(%) K:(%); - nnormalize; - ##[ ##2: #H6; ndestruct (*napply (bool_destruct … H6)*) ##] - nletin K1 ≝ (H2 y1 y2); - ncases (f2 y1 y2) in K1:(%) ⊢ %; - nnormalize; - ##[ ##2: #H6; #H7; ndestruct (*napply (bool_destruct … H7)*) ##] - nletin K2 ≝ (H3 z1 z2); - ncases (f3 z1 z2) in K2:(%) ⊢ %; - nnormalize; - ##[ ##2: #H6; #H7; #H8; ndestruct (*napply (bool_destruct … H8)*) ##] - nletin K3 ≝ (H4 v1 v2); - ncases (f4 v1 v2) in K3:(%) ⊢ %; - nnormalize; - ##[ ##2: #H6; #H7; #H8; #H9; ndestruct (*napply (bool_destruct … H9)*) ##] - #H6; #H7; #H8; #H9; #H10; - nrewrite > (H6 (refl_eq …)); - nrewrite > (H7 (refl_eq …)); - nrewrite > (H8 (refl_eq …)); - nrewrite > (H10 (refl_eq …)); - nrewrite > (H5 w1 w2 H9); - napply refl_eq. -nqed. - -nlemma decidable_quintuple - : ∀T1,T2,T3,T4,T5. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - (∀x,y:T5.decidable (x = y)) → - ∀x,y:Prod5T T1 T2 T3 T4 T5.decidable (x = y). - #T1; #T2; #T3; #T4; #T5; #H; #H1; #H2; #H3; #H4; - #x; nelim x; #xx1; #xx2; #xx3; #xx4; #xx5; - #y; nelim y; #yy1; #yy2; #yy3; #yy4; #yy5; - nnormalize; - napply (or2_elim (xx1 = yy1) (xx1 ≠ yy1) ? (H xx1 yy1) ?); - ##[ ##2: #H5; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H6; napply (H5 (quintuple_destruct_1 T1 T2 T3 T4 T5 … H6)) - ##| ##1: #H5; napply (or2_elim (xx2 = yy2) (xx2 ≠ yy2) ? (H1 xx2 yy2) ?); - ##[ ##2: #H6; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H7; napply (H6 (quintuple_destruct_2 T1 T2 T3 T4 T5 … H7)) - ##| ##1: #H6; napply (or2_elim (xx3 = yy3) (xx3 ≠ yy3) ? (H2 xx3 yy3) ?); - ##[ ##2: #H7; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H8; napply (H7 (quintuple_destruct_3 T1 T2 T3 T4 T5 … H8)) - ##| ##1: #H7; napply (or2_elim (xx4 = yy4) (xx4 ≠ yy4) ? (H3 xx4 yy4) ?); - ##[ ##2: #H8; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H9; napply (H8 (quintuple_destruct_4 T1 T2 T3 T4 T5 … H9)) - ##| ##1: #H8; napply (or2_elim (xx5 = yy5) (xx5 ≠ yy5) ? (H4 xx5 yy5) ?); - ##[ ##2: #H9; napply (or2_intro2 (? = ?) (? ≠ ?) ?); - nnormalize; #H10; napply (H9 (quintuple_destruct_5 T1 T2 T3 T4 T5 … H10)) - ##| ##1: #H9; napply (or2_intro1 (? = ?) (? ≠ ?) ?); - nrewrite > H5; - nrewrite > H6; - nrewrite > H7; - nrewrite > H8; - nrewrite > H9; - napply refl_eq - ##] - ##] - ##] - ##] - ##] -nqed. - -nlemma neqquintuple_to_neq : - ∀T1,T2,T3,T4,T5.∀p1,p2:Prod5T T1 T2 T3 T4 T5. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool.∀f5:T5 → T5 → bool. - (∀x,y:T1.f1 x y = false → x ≠ y) → - (∀x,y:T2.f2 x y = false → x ≠ y) → - (∀x,y:T3.f3 x y = false → x ≠ y) → - (∀x,y:T4.f4 x y = false → x ≠ y) → - (∀x,y:T5.f5 x y = false → x ≠ y) → - (eq_quintuple T1 T2 T3 T4 T5 p1 p2 f1 f2 f3 f4 f5 = false → p1 ≠ p2). - #T1; #T2; #T3; #T4; #T5; #p1; #p2; #f1; #f2; #f3; #f4; #f5; #H1; #H2; #H3; #H4; #H5; - nelim p1; - #x1; #y1; #z1; #v1; #w1; - nelim p2; - #x2; #y2; #z2; #v2; #w2; - nchange with ((((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2) ⊗ (f4 v1 v2) ⊗ (f5 w1 w2)) = false) → ?); #H; - nnormalize; #H6; - napply (or5_elim ((f1 x1 x2) = false) ((f2 y1 y2) = false) ((f3 z1 z2) = false) ((f4 v1 v2) = false) ((f5 w1 w2) = false) ? (andb_false5 … H) ?); - ##[ ##1: #H7; napply (H1 x1 x2 H7); napply (quintuple_destruct_1 T1 T2 T3 T4 T5 … H6) - ##| ##2: #H7; napply (H2 y1 y2 H7); napply (quintuple_destruct_2 T1 T2 T3 T4 T5 … H6) - ##| ##3: #H7; napply (H3 z1 z2 H7); napply (quintuple_destruct_3 T1 T2 T3 T4 T5 … H6) - ##| ##4: #H7; napply (H4 v1 v2 H7); napply (quintuple_destruct_4 T1 T2 T3 T4 T5 … H6) - ##| ##5: #H7; napply (H5 w1 w2 H7); napply (quintuple_destruct_5 T1 T2 T3 T4 T5 … H6) - ##] -nqed. - -nlemma quintuple_destruct - : ∀T1,T2,T3,T4,T5. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - (∀x,y:T5.decidable (x = y)) → - ∀x1,x2:T1.∀y1,y2:T2.∀z1,z2:T3.∀v1,v2:T4.∀w1,w2:T5. - (quintuple T1 T2 T3 T4 T5 x1 y1 z1 v1 w1) ≠ (quintuple T1 T2 T3 T4 T5 x2 y2 z2 v2 w2) → - Or5 (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2) (v1 ≠ v2) (w1 ≠ w2). - #T1; #T2; #T3; #T4; #T5; #H1; #H2; #H3; #H4; #H5; - #x1; #x2; #y1; #y2; #z1; #z2; #v1; #v2; #w1; #w2; - nnormalize; #H; - napply (or2_elim (x1 = x2) (x1 ≠ x2) ? (H1 x1 x2) ?); - ##[ ##2: #H6; napply (or5_intro1 … H6) - ##| ##1: #H6; napply (or2_elim (y1 = y2) (y1 ≠ y2) ? (H2 y1 y2) ?); - ##[ ##2: #H7; napply (or5_intro2 … H7) - ##| ##1: #H7; napply (or2_elim (z1 = z2) (z1 ≠ z2) ? (H3 z1 z2) ?); - ##[ ##2: #H8; napply (or5_intro3 … H8) - ##| ##1: #H8; napply (or2_elim (v1 = v2) (v1 ≠ v2) ? (H4 v1 v2) ?); - ##[ ##2: #H9; napply (or5_intro4 … H9) - ##| ##1: #H9; napply (or2_elim (w1 = w2) (w1 ≠ w2) ? (H5 w1 w2) ?); - ##[ ##2: #H10; napply (or5_intro5 … H10) - ##| ##1: #H10; nrewrite > H6 in H:(%); - nrewrite > H7; - nrewrite > H8; - nrewrite > H9; - nrewrite > H10; #H; nelim (H (refl_eq …)) - ##] - ##] - ##] - ##] - ##] -nqed. - -nlemma neq_to_neqquintuple : - ∀T1,T2,T3,T4,T5.∀p1,p2:Prod5T T1 T2 T3 T4 T5. - ∀f1:T1 → T1 → bool.∀f2:T2 → T2 → bool.∀f3:T3 → T3 → bool.∀f4:T4 → T4 → bool.∀f5:T5 → T5 → bool. - (∀x,y:T1.decidable (x = y)) → - (∀x,y:T2.decidable (x = y)) → - (∀x,y:T3.decidable (x = y)) → - (∀x,y:T4.decidable (x = y)) → - (∀x,y:T5.decidable (x = y)) → - (∀x,y:T1.x ≠ y → f1 x y = false) → - (∀x,y:T2.x ≠ y → f2 x y = false) → - (∀x,y:T3.x ≠ y → f3 x y = false) → - (∀x,y:T4.x ≠ y → f4 x y = false) → - (∀x,y:T5.x ≠ y → f5 x y = false) → - (p1 ≠ p2 → eq_quintuple T1 T2 T3 T4 T5 p1 p2 f1 f2 f3 f4 f5 = false). - #T1; #T2; #T3; #T4; #T5; #p1; #p2; - #f1; #f2; #f3; #f4; #f5; - #H1; #H2; #H3; #H4; #H5; #H6; #H7; #H8; #H9; #H10; - nelim p1; - #x1; #y1; #z1; #v1; #w1; - nelim p2; - #x2; #y2; #z2; #v2; #w2; #H; - nchange with (((f1 x1 x2) ⊗ (f2 y1 y2) ⊗ (f3 z1 z2) ⊗ (f4 v1 v2) ⊗ (f5 w1 w2)) = false); - napply (or5_elim (x1 ≠ x2) (y1 ≠ y2) (z1 ≠ z2) (v1 ≠ v2) (w1 ≠ w2) ? (quintuple_destruct T1 T2 T3 T4 T5 H1 H2 H3 H4 H5 … H) ?); - ##[ ##1: #H11; nrewrite > (H6 … H11); nrewrite > (andb_false5_1 (f2 y1 y2) (f3 z1 z2) (f4 v1 v2) (f5 w1 w2)); napply refl_eq - ##| ##2: #H11; nrewrite > (H7 … H11); nrewrite > (andb_false5_2 (f1 x1 x2) (f3 z1 z2) (f4 v1 v2) (f5 w1 w2)); napply refl_eq - ##| ##3: #H11; nrewrite > (H8 … H11); nrewrite > (andb_false5_3 (f1 x1 x2) (f2 y1 y2) (f4 v1 v2) (f5 w1 w2)); napply refl_eq - ##| ##4: #H11; nrewrite > (H9 … H11); nrewrite > (andb_false5_4 (f1 x1 x2) (f2 y1 y2) (f3 z1 z2) (f5 w1 w2)); napply refl_eq - ##| ##5: #H11; nrewrite > (H10 … H11); nrewrite > (andb_false5_5 (f1 x1 x2) (f2 y1 y2) (f3 z1 z2) (f4 v1 v2)); napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/sigma.ma b/helm/software/matita/contribs/ng_assembly/common/sigma.ma deleted file mode 100755 index 529ca7ada..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/sigma.ma +++ /dev/null @@ -1,52 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/theory.ma". - -(* coppia dipendente *) - -ninductive sigma (A:Type) (P:A → Type) : Type ≝ - sigma_intro: ∀x:A.P x → sigma A P. - -notation < "hvbox(\Sigma ident i opt (: tx) break . p)" - right associative with precedence 20 -for @{ 'Sigma ${default - @{\lambda ${ident i} : $tx. $p} - @{\lambda ${ident i} . $p}}}. - -notation > "\Sigma list1 ident x sep , opt (: T). term 19 Px" - with precedence 20 - for ${ default - @{ ${ fold right @{$Px} rec acc @{'Sigma (λ${ident x}:$T.$acc)} } } - @{ ${ fold right @{$Px} rec acc @{'Sigma (λ${ident x}.$acc)} } } - }. - -notation "\ll term 19 a, break term 19 b \gg" -with precedence 90 for @{'dependent_pair (λx:?.? x) $a $b}. -interpretation "dependent pair" 'dependent_pair \eta.c a b = (sigma_intro ? c a b). - -interpretation "sigma" 'Sigma \eta.x = (sigma ? x). - -ndefinition sigmaFst ≝ -λT:Type.λf:T → Type.λs:sigma T f.match s with [ sigma_intro x _ ⇒ x ]. -ndefinition sigmaSnd ≝ -λT:Type.λf:T → Type.λs:sigma T f.match s return λs.f (sigmaFst ?? s) with [ sigma_intro _ x ⇒ x ]. diff --git a/helm/software/matita/contribs/ng_assembly/common/string.ma b/helm/software/matita/contribs/ng_assembly/common/string.ma deleted file mode 100644 index 87ba11317..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/string.ma +++ /dev/null @@ -1,52 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/ascii.ma". -include "common/list_utility.ma". - -(* ************************ *) -(* MANIPOLAZIONE DI STRINGA *) -(* ************************ *) - -(* tipo pubblico *) -ndefinition aux_str_type ≝ list ascii. - -(* strcmp *) -ndefinition eq_str ≝ - bfold_right_list2 ascii (λx,y.eq_ascii x y). - -(* ************ *) -(* STRINGA + ID *) -(* ************ *) - -(* tipo pubblico *) -nrecord strId : Type ≝ - { - str_elem: aux_str_type; - id_elem: nat - }. - -(* confronto *) -ndefinition eq_strId ≝ -λsid,sid':strId. - (eq_str (str_elem sid) (str_elem sid'))⊗ - (eq_nat (id_elem sid) (id_elem sid')). diff --git a/helm/software/matita/contribs/ng_assembly/common/string_lemmas.ma b/helm/software/matita/contribs/ng_assembly/common/string_lemmas.ma deleted file mode 100755 index 53dcc50d1..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/string_lemmas.ma +++ /dev/null @@ -1,183 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/string.ma". -include "common/ascii_lemmas.ma". -include "common/list_utility_lemmas.ma". - -(* ************************ *) -(* MANIPOLAZIONE DI STRINGA *) -(* ************************ *) - -nlemma symmetric_eqstr : symmetricT (list ascii) bool eq_str. - #s1; #s2; - napply (symmetric_bfoldrightlist2 ascii eq_ascii s1 s2 symmetric_eqascii). -nqed. - -nlemma eqstr_to_eq : ∀s,s'.eq_str s s' = true → s = s'. - #s1; #s2; - napply (bfoldrightlist2_to_eq ascii eq_ascii s1 s2 eqascii_to_eq). -nqed. - -nlemma eq_to_eqstr : ∀s,s'.s = s' → eq_str s s' = true. - #s1; #s2; - napply (eq_to_bfoldrightlist2 ascii eq_ascii s1 s2 eq_to_eqascii). -nqed. - -nlemma decidable_str : ∀x,y:list ascii.decidable (x = y). - napply (decidable_list ascii …); - napply decidable_ascii. -nqed. - -nlemma neqstr_to_neq : ∀s,s'.eq_str s s' = false → s ≠ s'. - #s1; #s2; - napply (nbfoldrightlist2_to_neq ascii eq_ascii s1 s2 …); - napply neqascii_to_neq. -nqed. - -nlemma neq_to_neqstr : ∀s,s'.s ≠ s' → eq_str s s' = false. - #s1; #s2; - napply (neq_to_nbfoldrightlist2 ascii eq_ascii s1 s2 …); - ##[ ##1: napply decidable_ascii - ##| ##2: napply neq_to_neqascii - ##] -nqed. - -(* ************ *) -(* STRINGA + ID *) -(* ************ *) - -nlemma strid_destruct_1 : ∀x1,x2,y1,y2.mk_strId x1 y1 = mk_strId x2 y2 → x1 = x2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_strId x2 y2 with [ mk_strId a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma strid_destruct_2 : ∀x1,x2,y1,y2.mk_strId x1 y1 = mk_strId x2 y2 → y1 = y2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_strId x2 y2 with [ mk_strId _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqstrid : symmetricT strId bool eq_strId. - #si1; #si2; - nchange with ( - ((eq_str (str_elem si1) (str_elem si2))⊗(eq_nat (id_elem si1) (id_elem si2))) = - ((eq_str (str_elem si2) (str_elem si1))⊗(eq_nat (id_elem si2) (id_elem si1)))); - nrewrite > (symmetric_eqstr (str_elem si1) (str_elem si2)); - nrewrite > (symmetric_eqnat (id_elem si1) (id_elem si2)); - napply refl_eq. -nqed. - -nlemma eqstrid_to_eq : ∀s,s'.eq_strId s s' = true → s = s'. - #si1; #si2; - nelim si1; - #l1; #n1; - nelim si2; - #l2; #n2; #H; - nchange in H:(%) with (((eq_str l1 l2)⊗(eq_nat n1 n2)) = true); - nrewrite > (eqstr_to_eq l1 l2 (andb_true_true_l … H)); - nrewrite > (eqnat_to_eq n1 n2 (andb_true_true_r … H)); - napply refl_eq. -nqed. - -nlemma eq_to_eqstrid : ∀s,s'.s = s' → eq_strId s s' = true. - #si1; #si2; - nelim si1; - #l1; #n1; - nelim si2; - #l2; #n2; #H; - nchange with (((eq_str l1 l2)⊗(eq_nat n1 n2)) = true); - nrewrite > (strid_destruct_1 … H); - nrewrite > (strid_destruct_2 … H); - nrewrite > (eq_to_eqstr l2 l2 (refl_eq …)); - nrewrite > (eq_to_eqnat n2 n2 (refl_eq …)); - nnormalize; - napply refl_eq. -nqed. - -nlemma decidable_strid_aux1 : ∀s1,n1,s2,n2.s1 ≠ s2 → (mk_strId s1 n1) ≠ (mk_strId s2 n2). - #s1; #n1; #s2; #n2; - nnormalize; #H; #H1; - napply (H (strid_destruct_1 … H1)). -nqed. - -nlemma decidable_strid_aux2 : ∀s1,n1,s2,n2.n1 ≠ n2 → (mk_strId s1 n1) ≠ (mk_strId s2 n2). - #s1; #n1; #s2; #n2; - nnormalize; #H; #H1; - napply (H (strid_destruct_2 … H1)). -nqed. - -nlemma decidable_strid : ∀x,y:strId.decidable (x = y). - #x; nelim x; #s1; #n1; - #y; nelim y; #s2; #n2; - nnormalize; - napply (or2_elim (s1 = s2) (s1 ≠ s2) ? (decidable_str s1 s2) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_strid_aux1 … H)) - ##| ##1: #H; napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_nat n1 n2) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_strid_aux2 … H1)) - ##| ##1: #H1; nrewrite > H; nrewrite > H1; - napply (or2_intro1 … (refl_eq ? (mk_strId s2 n2))) - ##] - ##] -nqed. - -nlemma neqstrid_to_neq : ∀sid1,sid2:strId.(eq_strId sid1 sid2 = false) → (sid1 ≠ sid2). - #sid1; nelim sid1; #s1; #n1; - #sid2; nelim sid2; #s2; #n2; - nchange with ((((eq_str s1 s2) ⊗ (eq_nat n1 n2)) = false) → ?); - #H; - napply (or2_elim ((eq_str s1 s2) = false) ((eq_nat n1 n2) = false) ? (andb_false2 … H) …); - ##[ ##1: #H1; napply (decidable_strid_aux1 … (neqstr_to_neq … H1)) - ##| ##2: #H1; napply (decidable_strid_aux2 … (neqnat_to_neq … H1)) - ##] -nqed. - -nlemma strid_destruct : ∀s1,s2,n1,n2.(mk_strId s1 n1) ≠ (mk_strId s2 n2) → s1 ≠ s2 ∨ n1 ≠ n2. - #s1; #s2; #n1; #n2; - nnormalize; #H; - napply (or2_elim (s1 = s2) (s1 ≠ s2) ? (decidable_str s1 s2) …); - ##[ ##2: #H1; napply (or2_intro1 … H1) - ##| ##1: #H1; napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_nat n1 n2) …); - ##[ ##2: #H2; napply (or2_intro2 … H2) - ##| ##1: #H2; nrewrite > H1 in H:(%); - nrewrite > H2; - #H; nelim (H (refl_eq …)) - ##] - ##] -nqed. - -nlemma neq_to_neqstrid : ∀sid1,sid2.sid1 ≠ sid2 → eq_strId sid1 sid2 = false. - #sid1; nelim sid1; #s1; #n1; - #sid2; nelim sid2; #s2; #n2; - #H; nchange with (((eq_str s1 s2) ⊗ (eq_nat n1 n2)) = false); - napply (or2_elim (s1 ≠ s2) (n1 ≠ n2) ? (strid_destruct … H) …); - ##[ ##1: #H1; nrewrite > (neq_to_neqstr … H1); nnormalize; napply refl_eq - ##| ##2: #H1; nrewrite > (neq_to_neqnat … H1); - nrewrite > (symmetric_andbool (eq_str s1 s2) false); - nnormalize; napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/common/theory.ma b/helm/software/matita/contribs/ng_assembly/common/theory.ma deleted file mode 100644 index bab796daa..000000000 --- a/helm/software/matita/contribs/ng_assembly/common/theory.ma +++ /dev/null @@ -1,609 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| A.Asperti, C.Sacerdoti Coen, *) -(* ||A|| E.Tassi, S.Zacchiroli *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU Lesser General Public License Version 2.1 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -universe constraint Type[0] < Type[1]. -universe constraint Type[1] < Type[2]. -universe constraint Type[2] < Type[3]. -universe constraint Type[3] < Type[4]. - -(* ********************************** *) -(* SOTTOINSIEME MINIMALE DELLA TEORIA *) -(* ********************************** *) - -(* logic/connectives.ma *) - -ninductive True: Prop ≝ - I : True. - -ninductive False: Prop ≝. - -ndefinition Not: Prop → Prop ≝ -λA.(A → False). - -interpretation "logical not" 'not x = (Not x). - -nlemma absurd : ∀A,C:Prop.A → ¬A → C. - #A; #C; #H; - nnormalize; - #H1; - nelim (H1 H). -nqed. - -nlemma not_to_not : ∀A,B:Prop. (A → B) → ((¬B) → (¬A)). - #A; #B; #H; - nnormalize; - #H1; #H2; - nelim (H1 (H H2)). -nqed. - -nlemma prop_to_nnprop : ∀P.P → ¬¬P. - #P; nnormalize; #H; #H1; - napply (H1 H). -nqed. - -ninductive And2 (A,B:Prop) : Prop ≝ - conj2 : A → B → (And2 A B). - -interpretation "logical and" 'and x y = (And2 x y). - -nlemma proj2_1: ∀A,B:Prop.A ∧ B → A. - #A; #B; #H; - napply (And2_ind A B … H); - #H1; #H2; - napply H1. -nqed. - -nlemma proj2_2: ∀A,B:Prop.A ∧ B → B. - #A; #B; #H; - napply (And2_ind A B … H); - #H1; #H2; - napply H2. -nqed. - -ninductive And3 (A,B,C:Prop) : Prop ≝ - conj3 : A → B → C → (And3 A B C). - -nlemma proj3_1: ∀A,B,C:Prop.And3 A B C → A. - #A; #B; #C; #H; - napply (And3_ind A B C … H); - #H1; #H2; #H3; - napply H1. -nqed. - -nlemma proj3_2: ∀A,B,C:Prop.And3 A B C → B. - #A; #B; #C; #H; - napply (And3_ind A B C … H); - #H1; #H2; #H3; - napply H2. -nqed. - -nlemma proj3_3: ∀A,B,C:Prop.And3 A B C → C. - #A; #B; #C; #H; - napply (And3_ind A B C … H); - #H1; #H2; #H3; - napply H3. -nqed. - -ninductive And4 (A,B,C,D:Prop) : Prop ≝ - conj4 : A → B → C → D → (And4 A B C D). - -nlemma proj4_1: ∀A,B,C,D:Prop.And4 A B C D → A. - #A; #B; #C; #D; #H; - napply (And4_ind A B C D … H); - #H1; #H2; #H3; #H4; - napply H1. -nqed. - -nlemma proj4_2: ∀A,B,C,D:Prop.And4 A B C D → B. - #A; #B; #C; #D; #H; - napply (And4_ind A B C D … H); - #H1; #H2; #H3; #H4; - napply H2. -nqed. - -nlemma proj4_3: ∀A,B,C,D:Prop.And4 A B C D → C. - #A; #B; #C; #D; #H; - napply (And4_ind A B C D … H); - #H1; #H2; #H3; #H4; - napply H3. -nqed. - -nlemma proj4_4: ∀A,B,C,D:Prop.And4 A B C D → D. - #A; #B; #C; #D; #H; - napply (And4_ind A B C D … H); - #H1; #H2; #H3; #H4; - napply H4. -nqed. - -ninductive And5 (A,B,C,D,E:Prop) : Prop ≝ - conj5 : A → B → C → D → E → (And5 A B C D E). - -nlemma proj5_1: ∀A,B,C,D,E:Prop.And5 A B C D E → A. - #A; #B; #C; #D; #E; #H; - napply (And5_ind A B C D E … H); - #H1; #H2; #H3; #H4; #H5; - napply H1. -nqed. - -nlemma proj5_2: ∀A,B,C,D,E:Prop.And5 A B C D E → B. - #A; #B; #C; #D; #E; #H; - napply (And5_ind A B C D E … H); - #H1; #H2; #H3; #H4; #H5; - napply H2. -nqed. - -nlemma proj5_3: ∀A,B,C,D,E:Prop.And5 A B C D E → C. - #A; #B; #C; #D; #E; #H; - napply (And5_ind A B C D E … H); - #H1; #H2; #H3; #H4; #H5; - napply H3. -nqed. - -nlemma proj5_4: ∀A,B,C,D,E:Prop.And5 A B C D E → D. - #A; #B; #C; #D; #E; #H; - napply (And5_ind A B C D E … H); - #H1; #H2; #H3; #H4; #H5; - napply H4. -nqed. - -nlemma proj5_5: ∀A,B,C,D,E:Prop.And5 A B C D E → E. - #A; #B; #C; #D; #E; #H; - napply (And5_ind A B C D E … H); - #H1; #H2; #H3; #H4; #H5; - napply H5. -nqed. - -ninductive Or2 (A,B:Prop) : Prop ≝ - or2_intro1 : A → (Or2 A B) -| or2_intro2 : B → (Or2 A B). - -interpretation "logical or" 'or x y = (Or2 x y). - -ndefinition decidable ≝ λA:Prop.A ∨ (¬A). - -nlemma or2_elim - : ∀P1,P2,Q:Prop.Or2 P1 P2 → ∀f1:P1 → Q.∀f2:P2 → Q.Q. - #P1; #P2; #Q; #H; #f1; #f2; - napply (Or2_ind P1 P2 ? f1 f2 ?); - napply H. -nqed. - -nlemma symmetric_or2 : ∀P1,P2.Or2 P1 P2 → Or2 P2 P1. - #P1; #P2; #H; - napply (or2_elim P1 P2 ? H); - ##[ ##1: #H1; napply (or2_intro2 P2 P1 H1) - ##| ##2: #H1; napply (or2_intro1 P2 P1 H1) - ##] -nqed. - -ninductive Or3 (A,B,C:Prop) : Prop ≝ - or3_intro1 : A → (Or3 A B C) -| or3_intro2 : B → (Or3 A B C) -| or3_intro3 : C → (Or3 A B C). - -nlemma or3_elim - : ∀P1,P2,P3,Q:Prop.Or3 P1 P2 P3 → ∀f1:P1 → Q.∀f2:P2 → Q.∀f3:P3 → Q.Q. - #P1; #P2; #P3; #Q; #H; #f1; #f2; #f3; - napply (Or3_ind P1 P2 P3 ? f1 f2 f3 ?); - napply H. -nqed. - -nlemma symmetric_or3_12 : ∀P1,P2,P3:Prop.Or3 P1 P2 P3 → Or3 P2 P1 P3. - #P1; #P2; #P3; #H; - napply (or3_elim P1 P2 P3 ? H); - ##[ ##1: #H1; napply (or3_intro2 P2 P1 P3 H1) - ##| ##2: #H1; napply (or3_intro1 P2 P1 P3 H1) - ##| ##3: #H1; napply (or3_intro3 P2 P1 P3 H1) - ##] -nqed. - -nlemma symmetric_or3_13 : ∀P1,P2,P3:Prop.Or3 P1 P2 P3 → Or3 P3 P2 P1. - #P1; #P2; #P3; #H; - napply (or3_elim P1 P2 P3 ? H); - ##[ ##1: #H1; napply (or3_intro3 P3 P2 P1 H1) - ##| ##2: #H1; napply (or3_intro2 P3 P2 P1 H1) - ##| ##3: #H1; napply (or3_intro1 P3 P2 P1 H1) - ##] -nqed. - -nlemma symmetric_or3_23 : ∀P1,P2,P3:Prop.Or3 P1 P2 P3 → Or3 P1 P3 P2. - #P1; #P2; #P3; #H; - napply (or3_elim P1 P2 P3 ? H); - ##[ ##1: #H1; napply (or3_intro1 P1 P3 P2 H1) - ##| ##2: #H1; napply (or3_intro3 P1 P3 P2 H1) - ##| ##3: #H1; napply (or3_intro2 P1 P3 P2 H1) - ##] -nqed. - -ninductive Or4 (A,B,C,D:Prop) : Prop ≝ - or4_intro1 : A → (Or4 A B C D) -| or4_intro2 : B → (Or4 A B C D) -| or4_intro3 : C → (Or4 A B C D) -| or4_intro4 : D → (Or4 A B C D). - -nlemma or4_elim - : ∀P1,P2,P3,P4,Q:Prop.Or4 P1 P2 P3 P4 → ∀f1:P1 → Q.∀f2:P2 → Q. - ∀f3:P3 → Q.∀f4:P4 → Q.Q. - #P1; #P2; #P3; #P4; #Q; #H; #f1; #f2; #f3; #f4; - napply (Or4_ind P1 P2 P3 P4 ? f1 f2 f3 f4 ?); - napply H. -nqed. - -nlemma symmetric_or4_12 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P2 P1 P3 P4. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro2 P2 P1 P3 P4 H1) - ##| ##2: #H1; napply (or4_intro1 P2 P1 P3 P4 H1) - ##| ##3: #H1; napply (or4_intro3 P2 P1 P3 P4 H1) - ##| ##4: #H1; napply (or4_intro4 P2 P1 P3 P4 H1) - ##] -nqed. - -nlemma symmetric_or4_13 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P3 P2 P1 P4. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro3 P3 P2 P1 P4 H1) - ##| ##2: #H1; napply (or4_intro2 P3 P2 P1 P4 H1) - ##| ##3: #H1; napply (or4_intro1 P3 P2 P1 P4 H1) - ##| ##4: #H1; napply (or4_intro4 P3 P2 P1 P4 H1) - ##] -nqed. - -nlemma symmetric_or4_14 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P4 P2 P3 P1. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro4 P4 P2 P3 P1 H1) - ##| ##2: #H1; napply (or4_intro2 P4 P2 P3 P1 H1) - ##| ##3: #H1; napply (or4_intro3 P4 P2 P3 P1 H1) - ##| ##4: #H1; napply (or4_intro1 P4 P2 P3 P1 H1) - ##] -nqed. - -nlemma symmetric_or4_23 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P1 P3 P2 P4. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro1 P1 P3 P2 P4 H1) - ##| ##2: #H1; napply (or4_intro3 P1 P3 P2 P4 H1) - ##| ##3: #H1; napply (or4_intro2 P1 P3 P2 P4 H1) - ##| ##4: #H1; napply (or4_intro4 P1 P3 P2 P4 H1) - ##] -nqed. - -nlemma symmetric_or4_24 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P1 P4 P3 P2. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro1 P1 P4 P3 P2 H1) - ##| ##2: #H1; napply (or4_intro4 P1 P4 P3 P2 H1) - ##| ##3: #H1; napply (or4_intro3 P1 P4 P3 P2 H1) - ##| ##4: #H1; napply (or4_intro2 P1 P4 P3 P2 H1) - ##] -nqed. - -nlemma symmetric_or4_34 : ∀P1,P2,P3,P4:Prop.Or4 P1 P2 P3 P4 → Or4 P1 P2 P4 P3. - #P1; #P2; #P3; #P4; #H; - napply (or4_elim P1 P2 P3 P4 ? H); - ##[ ##1: #H1; napply (or4_intro1 P1 P2 P4 P3 H1) - ##| ##2: #H1; napply (or4_intro2 P1 P2 P4 P3 H1) - ##| ##3: #H1; napply (or4_intro4 P1 P2 P4 P3 H1) - ##| ##4: #H1; napply (or4_intro3 P1 P2 P4 P3 H1) - ##] -nqed. - -ninductive Or5 (A,B,C,D,E:Prop) : Prop ≝ - or5_intro1 : A → (Or5 A B C D E) -| or5_intro2 : B → (Or5 A B C D E) -| or5_intro3 : C → (Or5 A B C D E) -| or5_intro4 : D → (Or5 A B C D E) -| or5_intro5 : E → (Or5 A B C D E). - -nlemma or5_elim - : ∀P1,P2,P3,P4,P5,Q:Prop.Or5 P1 P2 P3 P4 P5 → ∀f1:P1 → Q.∀f2:P2 → Q. - ∀f3:P3 → Q.∀f4:P4 → Q.∀f5:P5 → Q.Q. - #P1; #P2; #P3; #P4; #P5; #Q; #H; #f1; #f2; #f3; #f4; #f5; - napply (Or5_ind P1 P2 P3 P4 P5 ? f1 f2 f3 f4 f5 ?); - napply H. -nqed. - -nlemma symmetric_or5_12 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P2 P1 P3 P4 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro2 P2 P1 P3 P4 P5 H1) - ##| ##2: #H1; napply (or5_intro1 P2 P1 P3 P4 P5 H1) - ##| ##3: #H1; napply (or5_intro3 P2 P1 P3 P4 P5 H1) - ##| ##4: #H1; napply (or5_intro4 P2 P1 P3 P4 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P2 P1 P3 P4 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_13 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P3 P2 P1 P4 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro3 P3 P2 P1 P4 P5 H1) - ##| ##2: #H1; napply (or5_intro2 P3 P2 P1 P4 P5 H1) - ##| ##3: #H1; napply (or5_intro1 P3 P2 P1 P4 P5 H1) - ##| ##4: #H1; napply (or5_intro4 P3 P2 P1 P4 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P3 P2 P1 P4 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_14 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P4 P2 P3 P1 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro4 P4 P2 P3 P1 P5 H1) - ##| ##2: #H1; napply (or5_intro2 P4 P2 P3 P1 P5 H1) - ##| ##3: #H1; napply (or5_intro3 P4 P2 P3 P1 P5 H1) - ##| ##4: #H1; napply (or5_intro1 P4 P2 P3 P1 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P4 P2 P3 P1 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_15 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P5 P2 P3 P4 P1. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro5 P5 P2 P3 P4 P1 H1) - ##| ##2: #H1; napply (or5_intro2 P5 P2 P3 P4 P1 H1) - ##| ##3: #H1; napply (or5_intro3 P5 P2 P3 P4 P1 H1) - ##| ##4: #H1; napply (or5_intro4 P5 P2 P3 P4 P1 H1) - ##| ##5: #H1; napply (or5_intro1 P5 P2 P3 P4 P1 H1) - ##] -nqed. - -nlemma symmetric_or5_23 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P3 P2 P4 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P3 P2 P4 P5 H1) - ##| ##2: #H1; napply (or5_intro3 P1 P3 P2 P4 P5 H1) - ##| ##3: #H1; napply (or5_intro2 P1 P3 P2 P4 P5 H1) - ##| ##4: #H1; napply (or5_intro4 P1 P3 P2 P4 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P1 P3 P2 P4 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_24 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P4 P3 P2 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P4 P3 P2 P5 H1) - ##| ##2: #H1; napply (or5_intro4 P1 P4 P3 P2 P5 H1) - ##| ##3: #H1; napply (or5_intro3 P1 P4 P3 P2 P5 H1) - ##| ##4: #H1; napply (or5_intro2 P1 P4 P3 P2 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P1 P4 P3 P2 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_25 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P5 P3 P4 P2. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P5 P3 P4 P2 H1) - ##| ##2: #H1; napply (or5_intro5 P1 P5 P3 P4 P2 H1) - ##| ##3: #H1; napply (or5_intro3 P1 P5 P3 P4 P2 H1) - ##| ##4: #H1; napply (or5_intro4 P1 P5 P3 P4 P2 H1) - ##| ##5: #H1; napply (or5_intro2 P1 P5 P3 P4 P2 H1) - ##] -nqed. - -nlemma symmetric_or5_34 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P2 P4 P3 P5. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P2 P4 P3 P5 H1) - ##| ##2: #H1; napply (or5_intro2 P1 P2 P4 P3 P5 H1) - ##| ##3: #H1; napply (or5_intro4 P1 P2 P4 P3 P5 H1) - ##| ##4: #H1; napply (or5_intro3 P1 P2 P4 P3 P5 H1) - ##| ##5: #H1; napply (or5_intro5 P1 P2 P4 P3 P5 H1) - ##] -nqed. - -nlemma symmetric_or5_35 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P2 P5 P4 P3. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P2 P5 P4 P3 H1) - ##| ##2: #H1; napply (or5_intro2 P1 P2 P5 P4 P3 H1) - ##| ##3: #H1; napply (or5_intro5 P1 P2 P5 P4 P3 H1) - ##| ##4: #H1; napply (or5_intro4 P1 P2 P5 P4 P3 H1) - ##| ##5: #H1; napply (or5_intro3 P1 P2 P5 P4 P3 H1) - ##] -nqed. - -nlemma symmetric_or5_45 : ∀P1,P2,P3,P4,P5:Prop.Or5 P1 P2 P3 P4 P5 → Or5 P1 P2 P3 P5 P4. - #P1; #P2; #P3; #P4; #P5; #H; - napply (or5_elim P1 P2 P3 P4 P5 ? H); - ##[ ##1: #H1; napply (or5_intro1 P1 P2 P3 P5 P4 H1) - ##| ##2: #H1; napply (or5_intro2 P1 P2 P3 P5 P4 H1) - ##| ##3: #H1; napply (or5_intro3 P1 P2 P3 P5 P4 H1) - ##| ##4: #H1; napply (or5_intro5 P1 P2 P3 P5 P4 H1) - ##| ##5: #H1; napply (or5_intro4 P1 P2 P3 P5 P4 H1) - ##] -nqed. - -ninductive ex (A:Type) (Q:A → Prop) : Prop ≝ - ex_intro: ∀x:A.Q x → ex A Q. - -interpretation "exists" 'exists x = (ex ? x). - -ninductive ex2 (A:Type) (Q,R:A → Prop) : Prop ≝ - ex_intro2: ∀x:A.Q x → R x → ex2 A Q R. - -(* higher_order_defs/relations *) - -ndefinition relation : Type → Type ≝ -λA.A → A → Prop. - -ndefinition reflexive : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x:A.R x x. - -ndefinition symmetric : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x,y:A.R x y → R y x. - -ndefinition transitive : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x,y,z:A.R x y → R y z → R x z. - -ndefinition irreflexive : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x:A.¬ (R x x). - -ndefinition cotransitive : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x,y:A.R x y → ∀z:A. R x z ∨ R z y. - -ndefinition tight_apart : ∀A:Type.∀eq,ap:relation A.Prop ≝ -λA.λeq,ap.∀x,y:A. (¬ (ap x y) → eq x y) ∧ (eq x y → ¬ (ap x y)). - -ndefinition antisymmetric : ∀A:Type.∀R:relation A.Prop ≝ -λA.λR.∀x,y:A.R x y → ¬ (R y x). - -(* logic/equality.ma *) - -ninductive eq (A:Type) (x:A) : A → Prop ≝ - refl_eq : eq A x x. - -ndefinition refl ≝ refl_eq. - -interpretation "leibnitz's equality" 'eq t x y = (eq t x y). - -interpretation "leibnitz's non-equality" 'neq t x y = (Not (eq t x y)). - -nlemma eq_f : ∀T1,T2:Type.∀x,y:T1.∀f:T1 → T2.x = y → (f x) = (f y). - #T1; #T2; #x; #y; #f; #H; - nrewrite < H; - napply refl_eq. -nqed. - -nlemma eq_f2 : ∀T1,T2,T3:Type.∀x1,y1:T1.∀x2,y2:T2.∀f:T1 → T2 → T3.x1 = y1 → x2 = y2 → f x1 x2 = f y1 y2. - #T1; #T2; #T3; #x1; #y1; #x2; #y2; #f; #H1; #H2; - nrewrite < H1; - nrewrite < H2; - napply refl_eq. -nqed. - -nlemma neqf_to_neq : ∀T1,T2:Type.∀x,y:T1.∀f:T1 → T2.((f x) ≠ (f y)) → x ≠ y. - #T1; #T2; #x; #y; #f; - nnormalize; #H; #H1; - napply (H (eq_f … H1)). -nqed. - -nlemma symmetric_eq: ∀A:Type. symmetric A (eq A). - #A; - nnormalize; - #x; #y; #H; - nrewrite < H; - napply refl_eq. -nqed. - -nlemma eq_ind_r: ∀A:Type[0].∀x:A.∀P:A → Prop.P x → ∀y:A.y=x → P y. - #A; #x; #P; #H; #y; #H1; - nrewrite < (symmetric_eq … H1); - napply H. -nqed. - -ndefinition R0 ≝ λT:Type[0].λt:T.t. - -ndefinition R1 ≝ eq_rect_Type0. - -ndefinition R2 : - ∀T0:Type[0]. - ∀a0:T0. - ∀T1:∀x0:T0. a0=x0 → Type[0]. - ∀a1:T1 a0 (refl_eq ? a0). - ∀T2:∀x0:T0. ∀p0:a0=x0. ∀x1:T1 x0 p0. R1 ?? T1 a1 ? p0 = x1 → Type[0]. - ∀a2:T2 a0 (refl_eq ? a0) a1 (refl_eq ? a1). - ∀b0:T0. - ∀e0:a0 = b0. - ∀b1: T1 b0 e0. - ∀e1:R1 ?? T1 a1 ? e0 = b1. - T2 b0 e0 b1 e1. - #T0;#a0;#T1;#a1;#T2;#a2;#b0;#e0;#b1;#e1; - napply (eq_rect_Type0 ????? e1); - napply (R1 ?? ? ?? e0); - napply a2; -nqed. - -ndefinition R3 : - ∀T0:Type[0]. - ∀a0:T0. - ∀T1:∀x0:T0. a0=x0 → Type[0]. - ∀a1:T1 a0 (refl_eq ? a0). - ∀T2:∀x0:T0. ∀p0:a0=x0. ∀x1:T1 x0 p0. R1 ?? T1 a1 ? p0 = x1 → Type[0]. - ∀a2:T2 a0 (refl_eq ? a0) a1 (refl_eq ? a1). - ∀T3:∀x0:T0. ∀p0:a0=x0. ∀x1:T1 x0 p0.∀p1:R1 ?? T1 a1 ? p0 = x1. - ∀x2:T2 x0 p0 x1 p1.R2 ???? T2 a2 x0 p0 ? p1 = x2 → Type[0]. - ∀a3:T3 a0 (refl_eq ? a0) a1 (refl_eq ? a1) a2 (refl_eq ? a2). - ∀b0:T0. - ∀e0:a0 = b0. - ∀b1: T1 b0 e0. - ∀e1:R1 ?? T1 a1 ? e0 = b1. - ∀b2: T2 b0 e0 b1 e1. - ∀e2:R2 ???? T2 a2 b0 e0 ? e1 = b2. - T3 b0 e0 b1 e1 b2 e2. - #T0;#a0;#T1;#a1;#T2;#a2;#T3;#a3;#b0;#e0;#b1;#e1;#b2;#e2; - napply (eq_rect_Type0 ????? e2); - napply (R2 ?? ? ???? e0 ? e1); - napply a3; -nqed. - -ndefinition R4 : - ∀T0:Type[0]. - ∀a0:T0. - ∀T1:∀x0:T0. eq T0 a0 x0 → Type[0]. - ∀a1:T1 a0 (refl_eq T0 a0). - ∀T2:∀x0:T0. ∀p0:eq (T0 …) a0 x0. ∀x1:T1 x0 p0.eq (T1 …) (R1 T0 a0 T1 a1 x0 p0) x1 → Type[0]. - ∀a2:T2 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1). - ∀T3:∀x0:T0. ∀p0:eq (T0 …) a0 x0. ∀x1:T1 x0 p0.∀p1:eq (T1 …) (R1 T0 a0 T1 a1 x0 p0) x1. - ∀x2:T2 x0 p0 x1 p1.eq (T2 …) (R2 T0 a0 T1 a1 T2 a2 x0 p0 x1 p1) x2 → Type[0]. - ∀a3:T3 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1) - a2 (refl_eq (T2 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1)) a2). - ∀T4:∀x0:T0. ∀p0:eq (T0 …) a0 x0. ∀x1:T1 x0 p0.∀p1:eq (T1 …) (R1 T0 a0 T1 a1 x0 p0) x1. - ∀x2:T2 x0 p0 x1 p1.∀p2:eq (T2 …) (R2 T0 a0 T1 a1 T2 a2 x0 p0 x1 p1) x2. - ∀x3:T3 x0 p0 x1 p1 x2 p2.∀p3:eq (T3 …) (R3 T0 a0 T1 a1 T2 a2 T3 a3 x0 p0 x1 p1 x2 p2) x3. - Type[0]. - ∀a4:T4 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1) - a2 (refl_eq (T2 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1)) a2) - a3 (refl_eq (T3 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1) - a2 (refl_eq (T2 a0 (refl_eq T0 a0) a1 (refl_eq (T1 a0 (refl_eq T0 a0)) a1)) a2)) - a3). - ∀b0:T0. - ∀e0:eq (T0 …) a0 b0. - ∀b1: T1 b0 e0. - ∀e1:eq (T1 …) (R1 T0 a0 T1 a1 b0 e0) b1. - ∀b2: T2 b0 e0 b1 e1. - ∀e2:eq (T2 …) (R2 T0 a0 T1 a1 T2 a2 b0 e0 b1 e1) b2. - ∀b3: T3 b0 e0 b1 e1 b2 e2. - ∀e3:eq (T3 …) (R3 T0 a0 T1 a1 T2 a2 T3 a3 b0 e0 b1 e1 b2 e2) b3. - T4 b0 e0 b1 e1 b2 e2 b3 e3. - #T0;#a0;#T1;#a1;#T2;#a2;#T3;#a3;#T4;#a4;#b0;#e0;#b1;#e1;#b2;#e2;#b3;#e3; - napply (eq_rect_Type0 ????? e3); - napply (R3 ????????? e0 ? e1 ? e2); - napply a4; -nqed. - -nlemma symmetric_neq : ∀T:Type.∀x,y:T.x ≠ y → y ≠ x. - #T; #x; #y; - nnormalize; - #H; #H1; - nrewrite > H1 in H:(%); #H; - napply (H (refl_eq …)). -nqed. - -ndefinition relationT : Type → Type → Type ≝ -λA,T:Type.A → A → T. - -ndefinition symmetricT: ∀A,T:Type.∀R:relationT A T.Prop ≝ -λA,T.λR.∀x,y:A.R x y = R y x. - -ndefinition associative : ∀A:Type.∀R:relationT A A.Prop ≝ -λA.λR.∀x,y,z:A.R (R x y) z = R x (R y z). diff --git a/helm/software/matita/contribs/ng_assembly/compiler/ast_type.ma b/helm/software/matita/contribs/ng_assembly/compiler/ast_type.ma deleted file mode 100755 index 93a66f913..000000000 --- a/helm/software/matita/contribs/ng_assembly/compiler/ast_type.ma +++ /dev/null @@ -1,136 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "common/list_utility.ma". - -(* ************************* *) -(* dimensioni degli elementi *) -(* ************************* *) - -(* usato per definire nell'ast *) -ninductive ast_base_type : Type ≝ - AST_BASE_TYPE_BYTE8: ast_base_type -| AST_BASE_TYPE_WORD16: ast_base_type -| AST_BASE_TYPE_WORD32: ast_base_type. - -ninductive ast_type : Type ≝ - AST_TYPE_BASE: ast_base_type → ast_type -| AST_TYPE_ARRAY: ast_type → nat → ast_type -| AST_TYPE_STRUCT: ne_list ast_type → ast_type. - -(* principio di eliminazione arricchito *) -nlet rec ast_type_index_aux (P:ast_type → Prop) - (f:Πt.P t → P (AST_TYPE_STRUCT (ne_nil ? t))) - (f1:Πh,t.P h → P (AST_TYPE_STRUCT t) → P (AST_TYPE_STRUCT (ne_cons ? h t))) - (f2:Πt.P t) - (t:ne_list ast_type) on t ≝ - match t return λt.P (AST_TYPE_STRUCT t) with - [ ne_nil h ⇒ f h (f2 h) - | ne_cons h t ⇒ f1 h t (f2 h) (ast_type_index_aux P f f1 f2 t) - ]. - -nlet rec ast_type_index (P:ast_type → Prop) - (f:Πb.P (AST_TYPE_BASE b)) - (f1:Πt,n.P t → P (AST_TYPE_ARRAY t n)) - (f2:Πt.P t → P (AST_TYPE_STRUCT (ne_nil ? t))) - (f3:Πh,t.P h → P (AST_TYPE_STRUCT t) → P (AST_TYPE_STRUCT (ne_cons ? h t))) - (t:ast_type) on t : P t ≝ - match t return λt.P t with - [ AST_TYPE_BASE b ⇒ f b - | AST_TYPE_ARRAY t' n ⇒ f1 t' n (ast_type_index P f f1 f2 f3 t') - | AST_TYPE_STRUCT nl ⇒ match nl with - [ ne_nil h ⇒ f2 h (ast_type_index P f f1 f2 f3 h) - | ne_cons h t ⇒ f3 h t (ast_type_index P f f1 f2 f3 h) (ast_type_index_aux P f2 f3 (ast_type_index P f f1 f2 f3) t) - ] - ]. - -nlet rec ast_type_rectex_aux (P:ast_type → Type) - (f:Πt.P t → P (AST_TYPE_STRUCT (ne_nil ? t))) - (f1:Πh,t.P h → P (AST_TYPE_STRUCT t) → P (AST_TYPE_STRUCT (ne_cons ? h t))) - (f2:Πt.P t) - (t:ne_list ast_type) on t ≝ - match t return λt.P (AST_TYPE_STRUCT t) with - [ ne_nil h ⇒ f h (f2 h) - | ne_cons h t ⇒ f1 h t (f2 h) (ast_type_rectex_aux P f f1 f2 t) - ]. - -nlet rec ast_type_rectex (P:ast_type → Type) - (f:Πb.P (AST_TYPE_BASE b)) - (f1:Πt,n.P t → P (AST_TYPE_ARRAY t n)) - (f2:Πt.P t → P (AST_TYPE_STRUCT (ne_nil ? t))) - (f3:Πh,t.P h → P (AST_TYPE_STRUCT t) → P (AST_TYPE_STRUCT (ne_cons ? h t))) - (t:ast_type) on t : P t ≝ - match t return λt.P t with - [ AST_TYPE_BASE b ⇒ f b - | AST_TYPE_ARRAY t' n ⇒ f1 t' n (ast_type_rectex P f f1 f2 f3 t') - | AST_TYPE_STRUCT nl ⇒ match nl with - [ ne_nil h ⇒ f2 h (ast_type_rectex P f f1 f2 f3 h) - | ne_cons h t ⇒ f3 h t (ast_type_rectex P f f1 f2 f3 h) (ast_type_rectex_aux P f2 f3 (ast_type_rectex P f f1 f2 f3) t) - ] - ]. - -ndefinition eq_astbasetype ≝ -λt1,t2:ast_base_type.match t1 with - [ AST_BASE_TYPE_BYTE8 ⇒ match t2 with [ AST_BASE_TYPE_BYTE8 ⇒ true | _ ⇒ false ] - | AST_BASE_TYPE_WORD16 ⇒ match t2 with [ AST_BASE_TYPE_WORD16 ⇒ true | _ ⇒ false ] - | AST_BASE_TYPE_WORD32 ⇒ match t2 with [ AST_BASE_TYPE_WORD32 ⇒ true | _ ⇒ false ] - ]. - -nlet rec eq_asttype (t1,t2:ast_type) on t1 ≝ - match t1 with - [ AST_TYPE_BASE bType1 ⇒ match t2 with - [ AST_TYPE_BASE bType2 ⇒ eq_astbasetype bType1 bType2 - | _ ⇒ false ] - | AST_TYPE_ARRAY subType1 dim1 ⇒ match t2 with - [ AST_TYPE_ARRAY subType2 dim2 ⇒ (eq_asttype subType1 subType2) ⊗ (eq_nat dim1 dim2) - | _ ⇒ false ] - | AST_TYPE_STRUCT nelSubType1 ⇒ match t2 with - [ AST_TYPE_STRUCT nelSubType2 ⇒ bfold_right_neList2 ? (λx1,x2.eq_asttype x1 x2) nelSubType1 nelSubType2 - | _ ⇒ false - ] - ]. - -ndefinition is_ast_base_type ≝ -λast:ast_type.match ast with [ AST_TYPE_BASE _ ⇒ True | _ ⇒ False ]. - -ndefinition isb_ast_base_type ≝ -λast:ast_type.match ast with [ AST_TYPE_BASE _ ⇒ true | _ ⇒ false ]. - -ndefinition isnt_ast_base_type ≝ -λast:ast_type.match ast with [ AST_TYPE_BASE _ ⇒ False | _ ⇒ True ]. - -ndefinition isntb_ast_base_type ≝ -λast:ast_type.match ast with [ AST_TYPE_BASE _ ⇒ false | _ ⇒ true ]. - -ndefinition eval_size_base_type ≝ -λast:ast_base_type.match ast with - [ AST_BASE_TYPE_BYTE8 ⇒ nat1 - | AST_BASE_TYPE_WORD16 ⇒ nat2 - | AST_BASE_TYPE_WORD32 ⇒ nat4 - ]. - -nlet rec eval_size_type (ast:ast_type) on ast ≝ - match ast with - [ AST_TYPE_BASE b ⇒ eval_size_base_type b - | AST_TYPE_ARRAY sub_ast dim ⇒ (dim + nat1)*(eval_size_type sub_ast) - | AST_TYPE_STRUCT nel_ast ⇒ fold_right_neList … (λt,x.(eval_size_type t)+x) O nel_ast - ]. diff --git a/helm/software/matita/contribs/ng_assembly/compiler/ast_type_lemmas.ma b/helm/software/matita/contribs/ng_assembly/compiler/ast_type_lemmas.ma deleted file mode 100755 index 039e39b0f..000000000 --- a/helm/software/matita/contribs/ng_assembly/compiler/ast_type_lemmas.ma +++ /dev/null @@ -1,301 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "compiler/ast_type.ma". -include "common/list_utility_lemmas.ma". - -(* ************************* *) -(* dimensioni degli elementi *) -(* ************************* *) - -ndefinition astbasetype_destruct_aux ≝ -Πb1,b2:ast_base_type.ΠP:Prop.b1 = b2 → - match eq_astbasetype b1 b2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition astbasetype_destruct : astbasetype_destruct_aux. - #b1; #b2; #P; #H; - nrewrite < H; - nelim b1; - nnormalize; - napply (λx.x). -nqed. - -nlemma eq_to_eqastbasetype : ∀n1,n2.n1 = n2 → eq_astbasetype n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqastbasetype_to_neq : ∀n1,n2.eq_astbasetype n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_astbasetype n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqastbasetype n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqastbasetype_to_eq : ∀b1,b2.eq_astbasetype b1 b2 = true → b1 = b2. - #b1; #b2; ncases b1; ncases b2; nnormalize; - ##[ ##1,5,9: #H; napply refl_eq - ##| ##*: #H; napply (bool_destruct … H) - ##] -nqed. - -nlemma neq_to_neqastbasetype : ∀n1,n2.n1 ≠ n2 → eq_astbasetype n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_astbasetype n1 n2)); - napply (not_to_not (eq_astbasetype n1 n2 = true) (n1 = n2) ? H); - napply (eqastbasetype_to_eq n1 n2). -nqed. - -nlemma decidable_astbasetype : ∀x,y:ast_base_type.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_astbasetype x y = true) (eq_astbasetype x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqastbasetype_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqastbasetype_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqastbasetype : symmetricT ast_base_type bool eq_astbasetype. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_astbasetype n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqastbasetype n1 n2 H); - napply (symmetric_eq ? (eq_astbasetype n2 n1) false); - napply (neq_to_neqastbasetype n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. - -nlemma asttype_destruct_base_base : ∀b1,b2.AST_TYPE_BASE b1 = AST_TYPE_BASE b2 → b1 = b2. - #b1; #b2; #H; - nchange with (match AST_TYPE_BASE b2 with [ AST_TYPE_BASE a ⇒ b1 = a | _ ⇒ False ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma asttype_destruct_array_array_1 : ∀x1,x2,y1,y2.AST_TYPE_ARRAY x1 y1 = AST_TYPE_ARRAY x2 y2 → x1 = x2. - #x1; #x2; #y1; #y2; #H; - nchange with (match AST_TYPE_ARRAY x2 y2 with [ AST_TYPE_ARRAY a _ ⇒ x1 = a | _ ⇒ False ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma asttype_destruct_array_array_2 : ∀x1,x2,y1,y2.AST_TYPE_ARRAY x1 y1 = AST_TYPE_ARRAY x2 y2 → y1 = y2. - #x1; #x2; #y1; #y2; #H; - nchange with (match AST_TYPE_ARRAY x2 y2 with [ AST_TYPE_ARRAY _ b ⇒ y1 = b | _ ⇒ False ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma asttype_destruct_struct_struct : ∀b1,b2.AST_TYPE_STRUCT b1 = AST_TYPE_STRUCT b2 → b1 = b2. - #b1; #b2; #H; - nchange with (match AST_TYPE_STRUCT b2 with [ AST_TYPE_STRUCT a ⇒ b1 = a | _ ⇒ False ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -ndefinition asttype_destruct_aux ≝ -Πb1,b2:ast_type.ΠP:Prop.b1 = b2 → - match eq_asttype b1 b2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition asttype_destruct : asttype_destruct_aux. - #b1; #b2; #P; #H; - nrewrite > H; - napply (ast_type_index … b2); - ##[ ##1: #e; nchange with (match eq_astbasetype e e with [ true ⇒ P → P | false ⇒ P ]); - nrewrite > (eq_to_eqastbasetype e e (refl_eq …)); - nnormalize; napply (λx.x); - ##| ##2: #e; #n; #H; nchange with (match (eq_asttype e e)⊗(eq_nat n n) with [ true ⇒ P → P | false ⇒ P]); - nrewrite > (eq_to_eqnat n n (refl_eq …)); - nrewrite > (symmetric_andbool (eq_asttype e e) true); - nchange with (match eq_asttype e e with [ true ⇒ P → P | false ⇒ P]); - napply H; - ##| ##3: #e; #H; nchange with (match eq_asttype e e with [ true ⇒ P → P | false ⇒ P]); - napply H; - ##| ##4: #hh; #tt; #H; - nchange with (match bfold_right_neList2 ?? tt tt with [ true ⇒ P → P | false ⇒ P ] → - match (eq_asttype hh hh)⊗(bfold_right_neList2 ?? tt tt) with [ true ⇒ P → P | false ⇒ P ]); - #H1; - ncases (eq_asttype hh hh) in H:(%) ⊢ %; #H; - ncases (bfold_right_neList2 ? (λx1,x2.eq_asttype x1 x2) tt tt) in H1:(%) ⊢ %; #H1; - ##[ ##1: nnormalize; napply (λx.x); - ##| ##3: nnormalize in H:(%) ⊢ %; napply H - ##| ##*: nnormalize in H1:(%) ⊢ %; napply H1 - ##] - ##] -nqed. - -nlemma eq_to_eqasttype_aux1 - : ∀nl1,nl2. - ((eq_asttype (AST_TYPE_STRUCT nl1) (AST_TYPE_STRUCT nl2)) = true) → - ((bfold_right_neList2 ? (λx,y.eq_asttype x y) nl1 nl2) = true). - #nl1; #nl2; #H; - napply H. -nqed. - -nlemma eq_to_eqasttype : ∀t1,t2.t1 = t2 → eq_asttype t1 t2 = true. - #t1; - napply (ast_type_index … t1); - ##[ ##1: #b1; #t2; ncases t2; - ##[ ##1: #b2; #H; nrewrite > (asttype_destruct_base_base … H); - nchange with ((eq_astbasetype b2 b2) = true); - nrewrite > (eq_to_eqastbasetype b2 b2 (refl_eq …)); - napply refl_eq - ##| ##2: #st2; #n2; #H; napply (asttype_destruct … H) - ##| ##3: #nl2; #H; napply (asttype_destruct … H) - ##] - ##| ##2: #st1; #n1; #H; #t2; ncases t2; - ##[ ##2: #st2; #n2; #H1; nchange with (((eq_asttype st1 st2)⊗(eq_nat n1 n2)) = true); - nrewrite > (H st2 (asttype_destruct_array_array_1 … H1)); - nrewrite > (eq_to_eqnat n1 n2 (asttype_destruct_array_array_2 … H1)); - nnormalize; - napply refl_eq - ##| ##1: #b2; #H1; napply (asttype_destruct … H1) - ##| ##3: #nl2; #H1; napply (asttype_destruct … H1) - ##] - ##| ##3: #hh1; #H; #t2; ncases t2; - ##[ ##3: #nl2; ncases nl2; - ##[ ##1: #hh2; #H1; nchange with ((eq_asttype hh1 hh2) = true); - nrewrite > (H hh2 (nelist_destruct_nil_nil ? hh1 hh2 (asttype_destruct_struct_struct … H1))); - napply refl_eq - ##| ##2: #hh2; #ll2; #H1; nelim (nelist_destruct_nil_cons ? hh1 hh2 ll2 (asttype_destruct_struct_struct … H1)) - ##] - ##| ##1: #b2; #H1; napply (asttype_destruct … H1) - ##| ##2: #st2; #n2; #H1; napply (asttype_destruct … H1) - ##] - ##| ##4: #hh1; #ll1; #H; #H1; #t2; ncases t2; - ##[ ##3: #nl2; ncases nl2; - ##[ ##1: #hh2; #H2; nelim (nelist_destruct_cons_nil ? hh1 hh2 ll1 (asttype_destruct_struct_struct … H2)) - ##| ##2: #hh2; #ll2; #H2; nchange with (((eq_asttype hh1 hh2)⊗(bfold_right_neList2 ? (λx,y.eq_asttype x y) ll1 ll2)) = true); - nrewrite > (H hh2 (nelist_destruct_cons_cons_1 … (asttype_destruct_struct_struct … H2))); - nrewrite > (eq_to_eqasttype_aux1 ll1 ll2 (H1 (AST_TYPE_STRUCT ll2) ?)); - ##[ ##1: nnormalize; napply refl_eq - ##| ##2: nrewrite > (nelist_destruct_cons_cons_2 … (asttype_destruct_struct_struct … H2)); - napply refl_eq - ##] - ##] - ##| ##1: #b2; #H2; napply (asttype_destruct … H2) - ##| ##2: #st2; #n2; #H2; napply (asttype_destruct … H2) - ##] - ##] -nqed. - -nlemma neqasttype_to_neq : ∀n1,n2.eq_asttype n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_asttype n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqasttype n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqasttype_to_eq : ∀t1,t2.eq_asttype t1 t2 = true → t1 = t2. - #t1; - napply (ast_type_index … t1); - ##[ ##1: #b1; #t2; ncases t2; - ##[ ##1: #b2; #H; nchange in H:(%) with ((eq_astbasetype b1 b2) = true); - nrewrite > (eqastbasetype_to_eq b1 b2 H); - napply refl_eq - ##| ##2: #st2; #n2; nnormalize; #H; napply (bool_destruct … H) - ##| ##3: #nl2; nnormalize; #H; napply (bool_destruct … H) - ##] - ##| ##2: #st1; #n1; #H; #t2; ncases t2; - ##[ ##2: #st2; #n2; #H1; nchange in H1:(%) with (((eq_asttype st1 st2)⊗(eq_nat n1 n2)) = true); - nrewrite > (H st2 (andb_true_true_l … H1)); - nrewrite > (eqnat_to_eq n1 n2 (andb_true_true_r … H1)); - napply refl_eq - ##| ##1: #b2; nnormalize; #H1; napply (bool_destruct … H1) - ##| ##3: #nl2; nnormalize; #H1; napply (bool_destruct … H1) - ##] - ##| ##3: #hh1; #H; #t2; ncases t2; - ##[ ##3: #nl2; ncases nl2; - ##[ ##1: #hh2; #H1; nchange in H1:(%) with ((eq_asttype hh1 hh2) = true); - nrewrite > (H hh2 H1); - napply refl_eq - ##| ##2: #hh2; #ll2; nnormalize; #H1; napply (bool_destruct … H1) - ##] - ##| ##1: #b2; nnormalize; #H1; napply (bool_destruct … H1) - ##| ##2: #st2; #n2; nnormalize; #H1; napply (bool_destruct … H1) - ##] - ##| ##4: #hh1; #ll1; #H; #H1; #t2; ncases t2; - ##[ ##3: #nl2; ncases nl2; - ##[ ##1: #hh2; nnormalize; #H2; napply (bool_destruct … H2) - ##| ##2: #hh2; #ll2; #H2; nchange in H2:(%) with (((eq_asttype hh1 hh2)⊗(bfold_right_neList2 ? (λx,y.eq_asttype x y) ll1 ll2)) = true); - nrewrite > (H hh2 (andb_true_true_l … H2)); - nrewrite > (asttype_destruct_struct_struct ll1 ll2 (H1 (AST_TYPE_STRUCT ll2) (andb_true_true_r … H2))); - napply refl_eq - ##] - ##| ##1: #b2; nnormalize; #H2; napply (bool_destruct … H2) - ##| ##2: #st2; #n2; nnormalize; #H2; napply (bool_destruct … H2) - ##] - ##] -nqed. - -nlemma neq_to_neqasttype : ∀n1,n2.n1 ≠ n2 → eq_asttype n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_asttype n1 n2)); - napply (not_to_not (eq_asttype n1 n2 = true) (n1 = n2) ? H); - napply (eqasttype_to_eq n1 n2). -nqed. - -nlemma decidable_asttype : ∀x,y:ast_type.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_asttype x y = true) (eq_asttype x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqasttype_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqasttype_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqasttype : symmetricT ast_type bool eq_asttype. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_asttype n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqasttype n1 n2 H); - napply (symmetric_eq ? (eq_asttype n2 n1) false); - napply (neq_to_neqasttype n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. - -nlemma isbastbasetype_to_isastbasetype : ∀ast.isb_ast_base_type ast = true → is_ast_base_type ast. - #ast; - ncases ast; - nnormalize; - ##[ ##1: #t; #H; napply I - ##| ##2: #t; #n; #H; napply (bool_destruct … H) - ##| ##3: #t; #H; napply (bool_destruct … H) - ##] -nqed. - -nlemma isntbastbasetype_to_isntastbasetype : ∀ast.isntb_ast_base_type ast = true → isnt_ast_base_type ast. - #ast; - ncases ast; - nnormalize; - ##[ ##1: #t; #H; napply (bool_destruct … H) - ##| ##2: #t; #n; #H; napply I - ##| ##3: #l; #H; napply I - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/compiler/environment.ma b/helm/software/matita/contribs/ng_assembly/compiler/environment.ma deleted file mode 100755 index 97183a661..000000000 --- a/helm/software/matita/contribs/ng_assembly/compiler/environment.ma +++ /dev/null @@ -1,64 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* *) -(* Sviluppato da: *) -(* Cosimo Oliboni, oliboni@cs.unibo.it *) -(* *) -(* ********************************************************************** *) - -include "common/string.ma". -include "compiler/ast_type.ma". - -(* ***************** *) -(* GESTIONE AMBIENTE *) -(* ***************** *) - -(* elemento: name + const + type *) -nrecord envDsc : Type ≝ - { - nameDsc: aux_str_type; - constDsc: bool; - typeDsc: ast_type - }. - -(* ambiente globale: (ambiente base + ambienti annidati) *) -ninductive env_list : nat → Type ≝ - env_nil: list envDsc → env_list O -| env_cons: ∀n.list envDsc → env_list n → env_list (S n). - -ndefinition defined_envList ≝ -λd.λl:env_list d.match l with [ env_nil _ ⇒ False | env_cons _ _ _ ⇒ True ]. - -(* bisogna bypassare la carenza di inversion *) -nlemma defined_envList_S : ∀d.∀l:env_list (S d).defined_envList (S d) l. - #d; #l; - ngeneralize in match (refl_eq ? (S d)); - ncases l in ⊢ (? ? % ? → %); - ##[ ##1: #dsc; #H; nelim (nat_destruct_0_S … H) - ##| ##2: #n; #dsc; #sub; #H; - nnormalize; - napply I - ##] -nqed. - -ndefinition cut_first_envList_aux : Πd.env_list (S d) → env_list d ≝ -λd.λl:env_list (S d). - match l - return λX.λY:env_list X.defined_envList X Y → env_list (pred X) - with - [ env_nil h ⇒ λp:defined_envList O (env_nil h).False_rect_Type0 ? p - | env_cons n h t ⇒ λp:defined_envList (S n) (env_cons n h t).t - ] (defined_envList_S d l). diff --git a/helm/software/matita/contribs/ng_assembly/compiler/preast_tree.ma b/helm/software/matita/contribs/ng_assembly/compiler/preast_tree.ma deleted file mode 100755 index 27fbbb72c..000000000 --- a/helm/software/matita/contribs/ng_assembly/compiler/preast_tree.ma +++ /dev/null @@ -1,115 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "common/string.ma". -include "compiler/ast_type.ma". -include "num/word32.ma". - -(* ****************** *) -(* PREALBERO DI TOKEN *) -(* ****************** *) - -(* espressioni *) -ninductive preast_expr : Type ≝ - PREAST_EXPR_BYTE8 : byte8 → preast_expr -| PREAST_EXPR_WORD16: word16 → preast_expr -| PREAST_EXPR_WORD32: word32 → preast_expr - -| PREAST_EXPR_NEG: preast_expr → preast_expr -| PREAST_EXPR_NOT: preast_expr → preast_expr -| PREAST_EXPR_COM: preast_expr → preast_expr - -| PREAST_EXPR_ADD: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_SUB: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_MUL: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_DIV: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_SHR: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_SHL: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_AND: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_OR: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_XOR: preast_expr → preast_expr → preast_expr - -| PREAST_EXPR_GT : preast_expr → preast_expr → preast_expr -| PREAST_EXPR_GTE: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_LT : preast_expr → preast_expr → preast_expr -| PREAST_EXPR_LTE: preast_expr → preast_expr → preast_expr -| PREAST_EXPR_EQ : preast_expr → preast_expr → preast_expr -| PREAST_EXPR_NEQ: preast_expr → preast_expr → preast_expr - -| PREAST_EXPR_B8toW16 : preast_expr → preast_expr -| PREAST_EXPR_B8toW32 : preast_expr → preast_expr -| PREAST_EXPR_W16toB8 : preast_expr → preast_expr -| PREAST_EXPR_W16toW32: preast_expr → preast_expr -| PREAST_EXPR_W32toB8 : preast_expr → preast_expr -| PREAST_EXPR_W32toW16: preast_expr → preast_expr - -| PREAST_EXPR_ID: preast_var → preast_expr - -(* variabile: modificatori di array/struct dell'id *) -with preast_var : Type ≝ - PREAST_VAR_ID: aux_str_type → preast_var -| PREAST_VAR_ARRAY: preast_var → preast_expr → preast_var -| PREAST_VAR_STRUCT: preast_var → nat → preast_var. - -(* -------------------------- *) - -(* inizializzatori: ... valori ... *) -ninductive preast_init_val : Type ≝ - PREAST_INIT_VAL_BYTE8: byte8 → preast_init_val -| PREAST_INIT_VAL_WORD16: word16 → preast_init_val -| PREAST_INIT_VAL_WORD32: word32 → preast_init_val -| PREAST_INIT_VAL_ARRAY: ne_list preast_init_val → preast_init_val -| PREAST_INIT_VAL_STRUCT: ne_list preast_init_val → preast_init_val. - -(* - inizializzatori: ammesse solo due forme, no ibridi - 1) var1 = var2 - 2) var = ... valori ... -*) -ninductive preast_init : Type ≝ - PREAST_INIT_VAR: preast_var → preast_init -| PREAST_INIT_VAL: preast_init_val → preast_init. - -(* -------------------------- *) - -(* statement: assegnamento/while/if else if else *) -ninductive preast_stm : Type ≝ - PREAST_STM_ASG: preast_var → preast_expr → preast_stm -| PREAST_STM_WHILE: preast_expr → preast_decl → preast_stm -| PREAST_STM_IF: ne_list (ProdT preast_expr preast_decl) → option preast_decl → preast_stm - -(* dichiarazioni *) -with preast_decl : Type ≝ - PREAST_NO_DECL: list preast_stm → preast_decl -| PREAST_CONST_DECL: aux_str_type → ast_type → preast_init → preast_decl → preast_decl -| PREAST_VAR_DECL: aux_str_type → ast_type → option preast_init → preast_decl → preast_decl. - -(* -------------------------- *) - -(* programma *) -ninductive preast_root : Type ≝ - PREAST_ROOT: preast_decl → preast_root. - -(* -------------------------- *) - -(* programma vuoto *) -ndefinition empty_preast_prog ≝ PREAST_ROOT (PREAST_NO_DECL (nil ?)). diff --git a/helm/software/matita/contribs/ng_assembly/freescale/load_write.ma b/helm/software/matita/contribs/ng_assembly/freescale/load_write.ma deleted file mode 100755 index addedf2e3..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/load_write.ma +++ /dev/null @@ -1,946 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/model.ma". -include "freescale/translation.ma". - -(* errori possibili nel fetch *) -ninductive error_type : Type ≝ - ILL_OP: error_type -| ILL_FETCH_AD: error_type -| ILL_EX_AD: error_type. - -(* un tipo opzione ad hoc - - errore: interessa solo l'errore - - ok: interessa info e il nuovo pc -*) -ninductive fetch_result (A:Type) : Type ≝ - FetchERR : error_type → fetch_result A -| FetchOK : A → word16 → fetch_result A. - -(* **************************** *) -(* FETCH E ACCESSO ALLA MEMORIA *) -(* **************************** *) - -(* ausialiaria per RS08 read *) -(* come anticipato in status, nell'RS08 ci sono 2 registri importanti - memory mapped, quindi bisona intercettare la lettura. - NB: fare molta attenzione alle note sulle combinazioni possibili perche' - il comportamento della memoria nell'RS08 e' strano e ci sono - precise condizioni che impediscono una semantica circolare dell'accesso - (divergenza=assenza di definizione) *) -ndefinition RS08_memory_filter_read_aux ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16. -λT:Type.λfREG:byte8 → option T.λfMEM:aux_mem_type t → aux_chk_type t → word16 → option T. -match s with - [ mk_any_status alu mem chk _ ⇒ match alu with - [ mk_alu_RS08 _ _ _ _ xm psm _ _ ⇒ -(* - possibili accessi al registro X - 1) addr=000F: diretto - 2) addr=000E (X =0F): indiretto - 3) addr=00CF (PS=00): paging - - [NB] altre combinazioni non funzionano perche' la MCU non e' un oggetto reattivo: - non si possono combinare due effetti contemporaneamente! - per esempio accesso addr=00CE (PS=00,X=0F) non puo' produrre 2 indirezioni -*) - match eq_w16 addr 〈〈x0,x0〉:〈x0,xF〉〉 ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eq_b8 xm 〈x0,xF〉) ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈xC,xF〉〉 ⊗ eq_b8 psm 〈x0,x0〉) with - [ true ⇒ fREG xm - | false ⇒ -(* - possibili accessi al registro PS - 1) addr=001F: diretto - 2) addr=000E (X =1F): indiretto - 3) addr=00DF (PS=00): paging -*) - match eq_w16 addr 〈〈x0,x0〉:〈x1,xF〉〉 ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eq_b8 xm 〈x1,xF〉) ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈xD,xF〉〉 ⊗ eq_b8 psm 〈x0,x0〉) with - [ true ⇒ fREG psm - | false ⇒ -(* - accesso a D[X]: se accede a [00C0-00FF] e' la RAM fisica, non il paging - altrimenti sarebbero 2 indirezioni -*) - match eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 with - [ true ⇒ fMEM mem chk 〈〈x0,x0〉:xm〉 - | false ⇒ -(* - accesso al paging: [00pp pppp ppxx xxxx] con p=PS x=addr -*) - match inrange_w16 addr 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 with - [ true ⇒ fMEM mem chk (or_w16 (fst … (shr_w16 (fst … (shr_w16 〈psm:〈x0,x0〉〉)))) - (and_w16 addr 〈〈x0,x0〉:〈x3,xF〉〉)) -(* - accesso normale -*) - | false ⇒ fMEM mem chk addr ]]]]]]. - -(* lettura RS08 di un byte *) -ndefinition RS08_memory_filter_read ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16. - RS08_memory_filter_read_aux t s addr byte8 - (λb.Some byte8 b) - (λm:aux_mem_type t.λc:aux_chk_type t.λa:word16.mem_read t m c a). - -(* lettura RS08 di un bit *) -ndefinition RS08_memory_filter_read_bit ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λsub:oct. - RS08_memory_filter_read_aux t s addr bool - (λb.Some bool (getn_array8T sub bool (bits_of_byte8 b))) - (λm:aux_mem_type t.λc:aux_chk_type t.λa:word16.mem_read_bit t m c a sub). - -(* in caso di RS08 si dirotta sul filtro, altrimenti si legge direttamente *) -ndefinition memory_filter_read ≝ -λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word16 → option byte8 with - [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16. - mem_read t (mem_desc ? t s) (chk_desc ? t s) addr - | HC08 ⇒ λs:any_status HC08 t.λaddr:word16. - mem_read t (mem_desc ? t s) (chk_desc ? t s) addr - | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16. - mem_read t (mem_desc ? t s) (chk_desc ? t s) addr - | RS08 ⇒ λs:any_status RS08 t.λaddr:word16. - RS08_memory_filter_read t s addr - ]. - -ndefinition memory_filter_read_bit ≝ -λm:mcu_type.λt:memory_impl.match m return λm:mcu_type.any_status m t → word16 → oct → option bool with - [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16.λsub:oct. - mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub - | HC08 ⇒ λs:any_status HC08 t.λaddr:word16.λsub:oct. - mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub - | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16.λsub:oct. - mem_read_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub - | RS08 ⇒ λs:any_status RS08 t.λaddr:word16.λsub:oct. - RS08_memory_filter_read_bit t s addr sub - ]. - -(* ausialiaria per RS08 write *) -(* come anticipato in status, nell'RS08 ci sono 2 registri importanti - memory mapped, quindi bisona intercettare la scrittura. - NB: fare molta attenzione alle note sulle combinazioni possibili perche' - il comportamento della memoria nell'RS08 e' strano e ci sono - precise condizioni che impediscono una semantica circolare dell'accesso - (divergenza=assenza di definizione) *) -ndefinition RS08_memory_filter_write_aux ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16. -λfREG:byte8 → byte8.λfMEM:aux_mem_type t → aux_chk_type t → word16 → option (aux_mem_type t). -match s with - [ mk_any_status alu mem chk clk ⇒ match alu with - [ mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl ⇒ -(* - possibili accessi al registro X - 1) addr=000F: diretto - 2) addr=000E (X =0F): indiretto - 3) addr=00CF (PS=00): paging - - [NB] altre combinazioni non funzionano perche' la MCU non e' un oggetto reattivo: - non si possono combinare due effetti contemporaneamente! - per esempio accesso addr=00CE (PS=00,X=0F) non puo' produrre 2 indirezioni -*) - match eq_w16 addr 〈〈x0,x0〉:〈x0,xF〉〉 ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eq_b8 xm 〈x0,xF〉) ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈xC,xF〉〉 ⊗ eq_b8 psm 〈x0,x0〉) with - [ true ⇒ Some ? (mk_any_status RS08 t (mk_alu_RS08 acclow pc pcm spc (fREG xm) psm zfl cfl) mem chk clk) - | false ⇒ -(* - possibili accessi al registro PS - 1) addr=001F: diretto - 2) addr=000E (X =1F): indiretto - 3) addr=00DF (PS=00): paging -*) - match eq_w16 addr 〈〈x0,x0〉:〈x1,xF〉〉 ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 ⊗ eq_b8 xm 〈x1,xF〉) ⊕ - (eq_w16 addr 〈〈x0,x0〉:〈xD,xF〉〉 ⊗ eq_b8 psm 〈x0,x0〉) with - [ true ⇒ Some ? (mk_any_status RS08 t (mk_alu_RS08 acclow pc pcm spc xm (fREG psm) zfl cfl) mem chk clk) - | false ⇒ -(* - accesso a D[X]: se accede a [00C0-00FF] e' la RAM fisica, non il paging - altrimenti sarebbero 2 indirezioni -*) - match eq_w16 addr 〈〈x0,x0〉:〈x0,xE〉〉 with - [ true ⇒ opt_map … (fMEM mem chk 〈〈x0,x0〉:xm〉) - (λmem'.Some ? (mk_any_status RS08 t (mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl) mem' chk clk)) - - | false ⇒ -(* - accesso al paging: [00pp pppp ppxx xxxx] con p=PS x=addr -*) - match inrange_w16 addr 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 with - [ true ⇒ opt_map … (fMEM mem chk (or_w16 (fst … (shr_w16 (fst … (shr_w16 〈psm:〈x0,x0〉〉)))) - (and_w16 addr 〈〈x0,x0〉:〈x3,xF〉〉))) - (λmem'.Some ? (mk_any_status RS08 t (mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl) mem' chk clk)) -(* - accesso normale -*) - | false ⇒ opt_map … (fMEM mem chk addr) - (λmem'.Some ? (mk_any_status RS08 t (mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl) mem' chk clk)) ]]]]]]. - -(* scrittura RS08 di un byte *) -ndefinition RS08_memory_filter_write ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λval:byte8. - RS08_memory_filter_write_aux t s addr - (λb.val) - (λm:aux_mem_type t.λc:aux_chk_type t.λa:word16.mem_update t m c a val). - -(* scrittura RS08 di un bit *) -ndefinition RS08_memory_filter_write_bit ≝ -λt:memory_impl.λs:any_status RS08 t.λaddr:word16.λsub:oct.λval:bool. - RS08_memory_filter_write_aux t s addr - (λb.byte8_of_bits (setn_array8T sub bool (bits_of_byte8 b) val)) - (λm:aux_mem_type t.λc:aux_chk_type t.λa:word16.mem_update_bit t m c a sub val). - -(* in caso di RS08 si dirotta sul filtro, altrimenti si scrive direttamente *) -ndefinition memory_filter_write ≝ -λm:mcu_type.λt:memory_impl.match m - return λm:mcu_type.any_status m t → word16 → byte8 → option (any_status m t) with - [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16.λval:byte8. - opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | HC08 ⇒ λs:any_status HC08 t.λaddr:word16.λval:byte8. - opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16.λval:byte8. - opt_map … (mem_update t (mem_desc ? t s) (chk_desc ? t s) addr val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | RS08 ⇒ λs:any_status RS08 t.λaddr:word16.λval:byte8. - RS08_memory_filter_write t s addr val - ]. - -ndefinition memory_filter_write_bit ≝ -λm:mcu_type.λt:memory_impl.match m - return λm:mcu_type.any_status m t → word16 → oct → bool → option (any_status m t) with - [ HC05 ⇒ λs:any_status HC05 t.λaddr:word16.λsub:oct.λval:bool. - opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | HC08 ⇒ λs:any_status HC08 t.λaddr:word16.λsub:oct.λval:bool. - opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | HCS08 ⇒ λs:any_status HCS08 t.λaddr:word16.λsub:oct.λval:bool. - opt_map … (mem_update_bit t (mem_desc ? t s) (chk_desc ? t s) addr sub val) - (λmem.Some ? (set_mem_desc ? t s mem)) - | RS08 ⇒ λs:any_status RS08 t.λaddr:word16.λsub:oct.λval:bool. - RS08_memory_filter_write_bit t s addr sub val - ]. - -(* - Da utilizzarsi solo per gli aggiornamenti di PC (per il fetch), - NON per il caricamento degli indiretti. - - il caricamento degli immediati spetta al fetcher - (incremento progressivo di PC ciclo per ciclo, e riempimento del prefetch - che a questo punto DEVE poter indirizzare qualsiasi locazione puntata da PC) - - il caricamento degli indiretti non spetta al fetcher -*) -ndefinition filtered_inc_w16 ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λw:word16. - get_pc_reg m t (set_pc_reg m t s (succ_w16 w)). - -nlet rec filtered_plus_w16 (m:mcu_type) (t:memory_impl) (s:any_status m t) (w:word16) (n:nat) on n ≝ - match n with - [ O ⇒ w - | S n' ⇒ filtered_plus_w16 m t s (filtered_inc_w16 m t s w) n' ]. - -(* - errore1: non esiste traduzione ILL_OP - errore2: non e' riuscito a leggere ILL_FETCH_AD - altrimenti OK=info+new_pc -*) -ndefinition fetch ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - let pc ≝ get_pc_reg m t s in - let pc_next1 ≝ filtered_inc_w16 m t s pc in - let pc_next2 ≝ filtered_inc_w16 m t s pc_next1 in - match memory_filter_read m t s pc with - [ None ⇒ FetchERR ? ILL_FETCH_AD - | Some bh ⇒ match full_info_of_word16 m (Byte bh) with - (* non ha trovato una traduzione con 1 byte *) - [ None ⇒ match m with - (* HC05 non esistono op a 2 byte *) - [ HC05 ⇒ FetchERR ? ILL_OP - | HC08 ⇒ match eq_b8 bh 〈x9,xE〉 with - (* HC08 se il primo byte e' 0x9E il secondo puo' avere senso *) - [ true ⇒ match memory_filter_read m t s pc_next1 with - [ None ⇒ FetchERR ? ILL_FETCH_AD | Some bl ⇒ match full_info_of_word16 m (Word (mk_word16 bh bl)) with - [ None ⇒ FetchERR ? ILL_OP | Some info ⇒ FetchOK ? info pc_next2 ]] - (* HC08 se il primo byte non e' 0x9E il secondo non puo' avere senso *) - | false ⇒ FetchERR ? ILL_OP - ] - | HCS08 ⇒ match eq_b8 bh 〈x9,xE〉 with - (* HCS08 se il primo byte e' 0x9E il secondo puo' avere senso *) - [ true ⇒ match memory_filter_read m t s pc_next1 with - [ None ⇒ FetchERR ? ILL_FETCH_AD | Some bl ⇒ match full_info_of_word16 m (Word (mk_word16 bh bl)) with - [ None ⇒ FetchERR ? ILL_OP | Some info ⇒ FetchOK ? info pc_next2 ]] - (* HCS08 se il primo byte non e' 0x9E il secondo non puo' avere senso *) - | false ⇒ FetchERR ? ILL_OP - ] - (* RS08 non esistono op a 2 byte *) - | RS08 ⇒ FetchERR ? ILL_OP - ] - (* ha trovato una traduzione con 1 byte *) - | Some info ⇒ FetchOK ? info pc_next1 ]]. - -(* ************************ *) -(* MODALITA' INDIRIZZAMENTO *) -(* ************************ *) - -(* mattoni base *) -(* - incrementano l'indirizzo normalmente *) -(* - incrementano PC attraverso il filtro *) - -(* lettura byte da addr *) -ndefinition loadb_from ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λcur_pc:word16.λfetched:nat. - opt_map … (memory_filter_read m t s addr) - (λb.Some ? (triple … s b (filtered_plus_w16 m t s cur_pc fetched))). - -(* lettura bit da addr *) -ndefinition loadbit_from ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λsub:oct.λcur_pc:word16.λfetched:nat. - opt_map … (memory_filter_read_bit m t s addr sub) - (λb.Some ? (triple … s b (filtered_plus_w16 m t s cur_pc fetched))). - -(* lettura word da addr *) -ndefinition loadw_from ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λcur_pc:word16.λfetched:nat. - opt_map … (memory_filter_read m t s addr) - (λbh.opt_map … (memory_filter_read m t s (succ_w16 addr)) - (λbl.Some ? (triple … s (mk_word16 bh bl) (filtered_plus_w16 m t s cur_pc fetched)))). - -(* scrittura byte su addr *) -ndefinition writeb_to ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λcur_pc:word16.λfetched:nat.λwriteb:byte8. - opt_map … (memory_filter_write m t s addr writeb) - (λtmps.Some ? (pair … tmps (filtered_plus_w16 m t s cur_pc fetched))). - -(* scrittura bit su addr *) -ndefinition writebit_to ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λsub:oct.λcur_pc:word16.λfetched:nat.λwriteb:bool. - opt_map … (memory_filter_write_bit m t s addr sub writeb) - (λtmps.Some ? (pair … tmps (filtered_plus_w16 m t s cur_pc fetched))). - -(* scrittura word su addr *) -ndefinition writew_to ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λaddr:word16.λcur_pc:word16.λfetched:nat.λwritew:word16. - opt_map … (memory_filter_write m t s addr (w16h writew)) - (λtmps1.opt_map … (memory_filter_write m t tmps1 (succ_w16 addr) (w16l writew)) - (λtmps2.Some ? (pair … tmps2 (filtered_plus_w16 m t tmps2 cur_pc fetched)))). - -(* ausiliari per definire i tipi e la lettura/scrittura *) - -(* ausiliaria per definire il tipo di aux_load *) -ndefinition aux_load_typing ≝ -λm:mcu_type.λt:memory_impl.λbyteflag:bool. - any_status m t → word16 → word16 → nat → - option (Prod3T (any_status m t) match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] word16). - -(* per non dover ramificare i vari load in byte/word *) -ndefinition aux_load ≝ -λm:mcu_type.λt:memory_impl.λbyteflag:bool.match byteflag return aux_load_typing m t with - [ true ⇒ loadb_from m t | false ⇒ loadw_from m t ]. - -(* ausiliaria per definire il tipo di aux_write *) -ndefinition aux_write_typing ≝ -λm:mcu_type.λt:memory_impl.λbyteflag:bool. - any_status m t → word16 → word16 → nat → - match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] → - option (ProdT (any_status m t) word16). - -(* per non dover ramificare i vari load in byte/word *) -ndefinition aux_write ≝ -λm:mcu_type.λt:memory_impl.λbyteflag:bool.match byteflag return aux_write_typing m t with - [ true ⇒ writeb_to m t | false ⇒ writew_to m t ]. - -(* modalita' vere e proprie *) - -(* lettura da [curpc]: IMM1 comportamento asimmetrico, quindi non si appoggia a loadb *) -ndefinition mode_IMM1_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λb.Some ? (triple … s b (filtered_inc_w16 m t s cur_pc))). - -(* lettura da [curpc]: IMM1 + estensione a word *) -ndefinition mode_IMM1EXT_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λb.Some ? (triple … s 〈〈x0,x0〉:b〉 (filtered_inc_w16 m t s cur_pc))). - -(* lettura da [curpc]: IMM2 comportamento asimmetrico, quindi non si appoggia a loadw *) -ndefinition mode_IMM2_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λbh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λbl.Some ? (triple … s (mk_word16 bh bl) (filtered_plus_w16 m t s cur_pc nat2)))). - -(* lettura da [byte [curpc]]: true=DIR1 loadb, false=DIR1 loadw *) -ndefinition mode_DIR1_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λaddr.(aux_load m t byteflag) s 〈〈x0,x0〉:addr〉 cur_pc nat1). - -(* lettura da [byte [curpc]]: loadbit *) -ndefinition mode_DIR1n_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λsub:oct. - opt_map … (memory_filter_read m t s cur_pc) - (λaddr.loadbit_from m t s 〈〈x0,x0〉:addr〉 sub cur_pc nat1). - -(* scrittura su [byte [curpc]]: true=DIR1 writeb, false=DIR1 writew *) -ndefinition mode_DIR1_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (memory_filter_read m t s cur_pc) - (λaddr.(aux_write m t byteflag) s 〈〈x0,x0〉:addr〉 cur_pc nat1 writebw). - -(* scrittura su [byte [curpc]]: writebit *) -ndefinition mode_DIR1n_write ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λsub:oct.λwriteb:bool. - opt_map … (memory_filter_read m t s cur_pc) - (λaddr.writebit_to m t s 〈〈x0,x0〉:addr〉 sub cur_pc nat1 writeb). - -(* lettura da [word [curpc]]: true=DIR2 loadb, false=DIR2 loadw *) -ndefinition mode_DIR2_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λaddrh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λaddrl.(aux_load m t byteflag) s 〈addrh:addrl〉 cur_pc nat2)). - -(* scrittura su [word [curpc]]: true=DIR2 writeb, false=DIR2 writew *) -ndefinition mode_DIR2_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (memory_filter_read m t s cur_pc) - (λaddrh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λaddrl.(aux_write m t byteflag) s 〈addrh:addrl〉 cur_pc nat2 writebw)). - -ndefinition get_IX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m with - [ HC05 ⇒ opt_map … (get_indX_8_low_reg m t s) (λindx.Some ? 〈〈x0,x0〉:indx〉) - | HC08 ⇒ opt_map … (get_indX_16_reg m t s) (λindx.Some ? indx) - | HCS08 ⇒ opt_map … (get_indX_16_reg m t s) (λindx.Some ? indx) - | RS08 ⇒ None ? ]. - -(* lettura da [IX]: true=IX0 loadb, false=IX0 loadw *) -ndefinition mode_IX0_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (get_IX m t s) - (λaddr.(aux_load m t byteflag) s addr cur_pc O). - -(* scrittura su [IX]: true=IX0 writeb, false=IX0 writew *) -ndefinition mode_IX0_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (get_IX m t s) - (λaddr.(aux_write m t byteflag) s addr cur_pc O writebw). - -(* lettura da [IX+byte [pc]]: true=IX1 loadb, false=IX1 loadw *) -ndefinition mode_IX1_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (get_IX m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffs.(aux_load m t byteflag) s (plus_w16_d_d addr 〈〈x0,x0〉:offs〉) cur_pc nat1)). - -(* lettura da X+[byte curpc] *) -ndefinition mode_IX1ADD_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λb.opt_map … (get_IX m t s) - (λaddr.Some ? (triple … s (plus_w16_d_d addr 〈〈x0,x0〉:b〉) (filtered_inc_w16 m t s cur_pc)))). - -(* scrittura su [IX+byte [pc]]: true=IX1 writeb, false=IX1 writew *) -ndefinition mode_IX1_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (get_IX m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffs.(aux_write m t byteflag) s (plus_w16_d_d addr 〈〈x0,x0〉:offs〉) cur_pc nat1 writebw)). - -(* lettura da [IX+word [pc]]: true=IX2 loadb, false=IX2 loadw *) -ndefinition mode_IX2_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (get_IX m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffsh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λoffsl.(aux_load m t byteflag) s (plus_w16_d_d addr 〈offsh:offsl〉) cur_pc nat2))). - -(* lettura da X+[word curpc] *) -ndefinition mode_IX2ADD_load ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (memory_filter_read m t s cur_pc) - (λbh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λbl.opt_map … (get_IX m t s) - (λaddr.Some ? (triple … s (plus_w16_d_d addr 〈bh:bl〉) (filtered_plus_w16 m t s cur_pc nat2))))). - -(* scrittura su [IX+word [pc]]: true=IX2 writeb, false=IX2 writew *) -ndefinition mode_IX2_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (get_IX m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffsh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λoffsl.(aux_write m t byteflag) s (plus_w16_d_d addr 〈offsh:offsl〉) cur_pc nat2 writebw))). - -(* lettura da [SP+byte [pc]]: true=SP1 loadb, false=SP1 loadw *) -ndefinition mode_SP1_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (get_sp_reg m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffs.(aux_load m t byteflag) s (plus_w16_d_d addr 〈〈x0,x0〉:offs〉) cur_pc nat1)). - -(* scrittura su [SP+byte [pc]]: true=SP1 writeb, false=SP1 writew *) -ndefinition mode_SP1_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (get_sp_reg m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffs.(aux_write m t byteflag) s (plus_w16_d_d addr 〈〈x0,x0〉:offs〉) cur_pc nat1 writebw)). - -(* lettura da [SP+word [pc]]: true=SP2 loadb, false=SP2 loadw *) -ndefinition mode_SP2_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. - opt_map … (get_sp_reg m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffsh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λoffsl.(aux_load m t byteflag) s (plus_w16_d_d addr 〈offsh:offsl〉) cur_pc nat2))). - -(* scrittura su [SP+word [pc]]: true=SP2 writeb, false=SP2 writew *) -ndefinition mode_SP2_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16. -λwritebw:match byteflag with [ true ⇒ byte8 | false ⇒ word16 ]. - opt_map … (get_sp_reg m t s) - (λaddr.opt_map … (memory_filter_read m t s cur_pc) - (λoffsh.opt_map … (memory_filter_read m t s (filtered_inc_w16 m t s cur_pc)) - (λoffsl.(aux_write m t byteflag) s (plus_w16_d_d addr 〈offsh:offsl〉) cur_pc nat2 writebw))). - -(* ************************************** *) -(* raccordo di tutte le possibili letture *) -(* ************************************** *) - -(* H:X++ *) -ndefinition aux_inc_indX_16 ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - opt_map … (get_indX_16_reg m t s) - (λX_op.opt_map … (set_indX_16_reg m t s (succ_w16 X_op)) - (λs_tmp.Some ? s_tmp)). - -(* tutte le modalita' di lettura: false=loadb true=loadw *) -ndefinition multi_mode_load ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl. - match byteflag - return λbyteflag:bool.any_status m t → word16 → instr_mode → - option (Prod3T (any_status m t) match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] word16) - with - (* lettura di un byte *) - [ true ⇒ λs:any_status m t.λcur_pc:word16.λi:instr_mode.match i with -(* NO: non ci sono indicazioni *) - [ MODE_INH ⇒ None ? -(* restituisce A *) - | MODE_INHA ⇒ Some ? (triple … s (get_acc_8_low_reg m t s) cur_pc) -(* restituisce X *) - | MODE_INHX ⇒ opt_map … (get_indX_8_low_reg m t s) - (λindx.Some ? (triple … s indx cur_pc)) -(* restituisce H *) - | MODE_INHH ⇒ opt_map … (get_indX_8_high_reg m t s) - (λindx.Some ? (triple … s indx cur_pc)) - -(* NO: solo lettura word *) - | MODE_INHX0ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX1ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX2ADD ⇒ None ? - -(* preleva 1 byte immediato *) - | MODE_IMM1 ⇒ mode_IMM1_load m t s cur_pc -(* NO: solo lettura word *) - | MODE_IMM1EXT ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM2 ⇒ None ? -(* preleva 1 byte da indirizzo diretto 1 byte *) - | MODE_DIR1 ⇒ mode_DIR1_load true m t s cur_pc -(* preleva 1 byte da indirizzo diretto 1 word *) - | MODE_DIR2 ⇒ mode_DIR2_load true m t s cur_pc -(* preleva 1 byte da H:X *) - | MODE_IX0 ⇒ mode_IX0_load true m t s cur_pc -(* preleva 1 byte da H:X+1 byte offset *) - | MODE_IX1 ⇒ mode_IX1_load true m t s cur_pc -(* preleva 1 byte da H:X+1 word offset *) - | MODE_IX2 ⇒ mode_IX2_load true m t s cur_pc -(* preleva 1 byte da SP+1 byte offset *) - | MODE_SP1 ⇒ mode_SP1_load true m t s cur_pc -(* preleva 1 byte da SP+1 word offset *) - | MODE_SP2 ⇒ mode_SP2_load true m t s cur_pc - -(* come DIR1, chiamare scrittura per passo2: scrittura su DIR1 *) - | MODE_DIR1_to_DIR1 ⇒ mode_DIR1_load true m t s cur_pc -(* come IMM1, chiamare scrittura per passo2: scrittura su DIR1 *) - | MODE_IMM1_to_DIR1 ⇒ mode_IMM1_load m t s cur_pc -(* come IX0, chiamare scrittura per passo2: scrittura su DIR1 e X++ *) - | MODE_IX0p_to_DIR1 ⇒ mode_IX0_load true m t s cur_pc -(* come DIR1, chiamare scrittura per passo2: scrittura su IX0 e X++ *) - | MODE_DIR1_to_IX0p ⇒ mode_DIR1_load true m t s cur_pc - -(* NO: solo lettura word/scrittura byte *) - | MODE_INHA_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_INHX_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM1_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_DIR1_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_IX0_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IX0p_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_IX1_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IX1p_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_SP1_and_IMM1 ⇒ None ? - -(* NO: solo scrittura byte *) - | MODE_DIRn _ ⇒ None ? -(* NO: solo lettura word *) - | MODE_DIRn_and_IMM1 _ ⇒ None ? -(* preleva 1 byte da 0000 0000 0000 xxxxb *) - | MODE_TNY e ⇒ opt_map … (memory_filter_read m t s 〈〈x0,x0〉:〈x0,e〉〉) - (λb.Some ? (triple … s b cur_pc)) -(* preleva 1 byte da 0000 0000 000x xxxxb *) - | MODE_SRT e ⇒ opt_map … (memory_filter_read m t s 〈〈x0,x0〉:(b8_of_bit e)〉) - (λb.Some ? (triple … s b cur_pc)) - ] -(* lettura di una word *) - | false ⇒ λs:any_status m t.λcur_pc:word16.λi:instr_mode.match i with -(* NO: non ci sono indicazioni *) - [ MODE_INH ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHA ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHX ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHH ⇒ None ? - -(* preleva 1 word immediato *) - | MODE_INHX0ADD ⇒ opt_map … (get_IX m t s) - (λw.Some ? (triple … s w cur_pc)) -(* preleva 1 word immediato *) - | MODE_INHX1ADD ⇒ mode_IX1ADD_load m t s cur_pc -(* preleva 1 word immediato *) - | MODE_INHX2ADD ⇒ mode_IX2ADD_load m t s cur_pc - -(* NO: solo lettura byte *) - | MODE_IMM1 ⇒ None ? -(* preleva 1 word immediato *) - | MODE_IMM1EXT ⇒ mode_IMM1EXT_load m t s cur_pc -(* preleva 1 word immediato *) - | MODE_IMM2 ⇒ mode_IMM2_load m t s cur_pc -(* preleva 1 word da indirizzo diretto 1 byte *) - | MODE_DIR1 ⇒ mode_DIR1_load false m t s cur_pc -(* preleva 1 word da indirizzo diretto 1 word *) - | MODE_DIR2 ⇒ mode_DIR2_load false m t s cur_pc -(* preleva 1 word da H:X *) - | MODE_IX0 ⇒ mode_IX0_load false m t s cur_pc -(* preleva 1 word da H:X+1 byte offset *) - | MODE_IX1 ⇒ mode_IX1_load false m t s cur_pc -(* preleva 1 word da H:X+1 word offset *) - | MODE_IX2 ⇒ mode_IX2_load false m t s cur_pc -(* preleva 1 word da SP+1 byte offset *) - | MODE_SP1 ⇒ mode_SP1_load false m t s cur_pc -(* preleva 1 word da SP+1 word offset *) - | MODE_SP2 ⇒ mode_SP2_load false m t s cur_pc - -(* NO: solo lettura/scrittura byte *) - | MODE_DIR1_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_IMM1_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_IX0p_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_DIR1_to_IX0p ⇒ None ? - -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_INHA_and_IMM1 ⇒ opt_map … (mode_IMM1_load m t s cur_pc) - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc' ⇒ - Some ? (triple … s 〈(get_acc_8_low_reg m t s):immb〉 cur_pc')]) -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_INHX_and_IMM1 ⇒ opt_map … (get_indX_8_low_reg m t s) - (λX_op.opt_map … (mode_IMM1_load m t s cur_pc) - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc' ⇒ - Some ? (triple … s 〈X_op:immb〉 cur_pc')])) -(* preleva 2 byte, NO possibilita' modificare Io argomento *) - | MODE_IMM1_and_IMM1 ⇒ opt_map … (mode_IMM1_load m t s cur_pc) - (λS_immb1_and_PC.match S_immb1_and_PC with - [ triple _ immb1 cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb2_and_PC.match S_immb2_and_PC with - [ triple _ immb2 cur_pc'' ⇒ - Some ? (triple … s 〈immb1:immb2〉 cur_pc'')])]) -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_DIR1_and_IMM1 ⇒ opt_map … (mode_DIR1_load true m t s cur_pc) - (λS_dirb_and_PC.match S_dirb_and_PC with - [ triple _ dirb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - Some ? (triple … s 〈dirb:immb〉 cur_pc'')])]) -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_IX0_and_IMM1 ⇒ opt_map … (mode_IX0_load true m t s cur_pc) - (λS_ixb_and_PC.match S_ixb_and_PC with - [ triple _ ixb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - Some ? (triple … s 〈ixb:immb〉 cur_pc'')])]) -(* preleva 2 byte, H:X++, NO possibilita' modificare Io argomento *) - | MODE_IX0p_and_IMM1 ⇒ opt_map … (mode_IX0_load true m t s cur_pc) - (λS_ixb_and_PC.match S_ixb_and_PC with - [ triple _ ixb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - (* H:X++ *) - opt_map … (aux_inc_indX_16 m t s) - (λs'.Some ? (triple … s' 〈ixb:immb〉 cur_pc''))])]) -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_IX1_and_IMM1 ⇒ opt_map … (mode_IX1_load true m t s cur_pc) - (λS_ixb_and_PC.match S_ixb_and_PC with - [ triple _ ixb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - Some ? (triple … s 〈ixb:immb〉 cur_pc'')])]) -(* preleva 2 byte, H:X++, NO possibilita' modificare Io argomento *) - | MODE_IX1p_and_IMM1 ⇒ opt_map … (mode_IX1_load true m t s cur_pc) - (λS_ixb_and_PC.match S_ixb_and_PC with - [ triple _ ixb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - (* H:X++ *) - opt_map … (aux_inc_indX_16 m t s) - (λs'.Some ? (triple … s' 〈ixb:immb〉 cur_pc''))])]) -(* preleva 2 byte, possibilita' modificare Io argomento *) - | MODE_SP1_and_IMM1 ⇒ opt_map … (mode_SP1_load true m t s cur_pc) - (λS_spb_and_PC.match S_spb_and_PC with - [ triple _ spb cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - Some ? (triple … s 〈spb:immb〉 cur_pc'')])]) - -(* NO: solo scrittura byte *) - | MODE_DIRn _ ⇒ None ? -(* preleva 2 byte, il primo e' filtrato per azzerare tutti i bit tranne n-simo *) - | MODE_DIRn_and_IMM1 msk ⇒ opt_map … (mode_DIR1n_load m t s cur_pc msk) - (λS_dirbn_and_PC.match S_dirbn_and_PC with - [ triple _ dirbn cur_pc' ⇒ - opt_map … (mode_IMM1_load m t s cur_pc') - (λS_immb_and_PC.match S_immb_and_PC with - [ triple _ immb cur_pc'' ⇒ - Some ? (triple … s 〈〈x0,match dirbn with [ true ⇒ x1 | false ⇒ x0 ]〉:immb〉 cur_pc'') ])]) -(* NO: solo lettura/scrittura byte *) - | MODE_TNY _ ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_SRT _ ⇒ None ? - ] - ]. - -(* **************************************** *) -(* raccordo di tutte le possibili scritture *) -(* **************************************** *) - -(* tutte le modalita' di scrittura: true=writeb, false=writew *) -ndefinition multi_mode_write ≝ -λbyteflag:bool.λm:mcu_type.λt:memory_impl.match byteflag - return λbyteflag:bool.any_status m t → word16 → instr_mode → - match byteflag with [ true ⇒ byte8 | false ⇒ word16 ] → - option (ProdT (any_status m t) word16) with - (* scrittura di un byte *) - [ true ⇒ λs:any_status m t.λcur_pc:word16.λi:instr_mode.λwriteb:byte8.match i with -(* NO: non ci sono indicazioni *) - [ MODE_INH ⇒ None ? -(* scrive A *) - | MODE_INHA ⇒ Some ? (pair … (set_acc_8_low_reg m t s writeb) cur_pc) -(* scrive X *) - | MODE_INHX ⇒ opt_map … (set_indX_8_low_reg m t s writeb) - (λtmps.Some ? (pair … tmps cur_pc)) -(* scrive H *) - | MODE_INHH ⇒ opt_map … (set_indX_8_high_reg m t s writeb) - (λtmps.Some ? (pair … tmps cur_pc)) - -(* NO: solo lettura word *) - | MODE_INHX0ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX1ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX2ADD ⇒ None ? - -(* NO: solo lettura byte *) - | MODE_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM1EXT ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM2 ⇒ None ? -(* scrive 1 byte su indirizzo diretto 1 byte *) - | MODE_DIR1 ⇒ mode_DIR1_write true m t s cur_pc writeb -(* scrive 1 byte su indirizzo diretto 1 word *) - | MODE_DIR2 ⇒ mode_DIR2_write true m t s cur_pc writeb -(* scrive 1 byte su H:X *) - | MODE_IX0 ⇒ mode_IX0_write true m t s cur_pc writeb -(* scrive 1 byte su H:X+1 byte offset *) - | MODE_IX1 ⇒ mode_IX1_write true m t s cur_pc writeb -(* scrive 1 byte su H:X+1 word offset *) - | MODE_IX2 ⇒ mode_IX2_write true m t s cur_pc writeb -(* scrive 1 byte su SP+1 byte offset *) - | MODE_SP1 ⇒ mode_SP1_write true m t s cur_pc writeb -(* scrive 1 byte su SP+1 word offset *) - | MODE_SP2 ⇒ mode_SP2_write true m t s cur_pc writeb - -(* passo2: scrittura su DIR1, passo1: lettura da DIR1 *) - | MODE_DIR1_to_DIR1 ⇒ mode_DIR1_write true m t s cur_pc writeb -(* passo2: scrittura su DIR1, passo1: lettura da IMM1 *) - | MODE_IMM1_to_DIR1 ⇒ mode_DIR1_write true m t s cur_pc writeb -(* passo2: scrittura su DIR1 e X++, passo1: lettura da IX0 *) - | MODE_IX0p_to_DIR1 ⇒ opt_map … (mode_DIR1_write true m t s cur_pc writeb) - (λS_and_PC.match S_and_PC with [ pair S_op PC_op ⇒ - (* H:X++ *) - opt_map … (aux_inc_indX_16 m t S_op) - (λS_op'.Some ? (pair … S_op' PC_op))]) -(* passo2: scrittura su IX0 e X++, passo1: lettura da DIR1 *) - | MODE_DIR1_to_IX0p ⇒ opt_map … (mode_IX0_write true m t s cur_pc writeb) - (λS_and_PC.match S_and_PC with [ pair S_op PC_op ⇒ - (* H:X++ *) - opt_map … (aux_inc_indX_16 m t S_op) - (λS_op'.Some ? (pair … S_op' PC_op))]) - -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = INHA *) - | MODE_INHA_and_IMM1 ⇒ Some ? (pair … (set_acc_8_low_reg m t s writeb) cur_pc) -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = INHX *) - | MODE_INHX_and_IMM1 ⇒ opt_map … (set_indX_8_low_reg m t s writeb) - (λtmps.Some ? (pair … tmps cur_pc)) -(* NO: solo lettura word *) - | MODE_IMM1_and_IMM1 ⇒ None ? -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = DIR1 *) - | MODE_DIR1_and_IMM1 ⇒ mode_DIR1_write true m t s cur_pc writeb -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = IX0 *) - | MODE_IX0_and_IMM1 ⇒ mode_IX0_write true m t s cur_pc writeb -(* NO: solo lettura word *) - | MODE_IX0p_and_IMM1 ⇒ None ? -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = IX1 *) - | MODE_IX1_and_IMM1 ⇒ mode_IX1_write true m t s cur_pc writeb -(* NO: solo lettura word *) - | MODE_IX1p_and_IMM1 ⇒ None ? -(* dopo aver prelevato 2 byte la possibilita' modificare Io argomento = SP1 *) - | MODE_SP1_and_IMM1 ⇒ mode_SP1_write true m t s cur_pc writeb - -(* scrive 1 byte, ma la scrittura avviene solo per n-simo bit = leggi/modifica bit/scrivi *) - | MODE_DIRn msk ⇒ mode_DIR1n_write m t s cur_pc msk (getn_array8T msk bool (bits_of_byte8 writeb)) -(* NO: solo lettura word *) - | MODE_DIRn_and_IMM1 _ ⇒ None ? -(* scrive 1 byte su 0000 0000 0000 xxxxb *) - | MODE_TNY e ⇒ opt_map … (memory_filter_write m t s 〈〈x0,x0〉:〈x0,e〉〉 writeb) - (λtmps.Some ? (pair … tmps cur_pc)) -(* scrive 1 byte su 0000 0000 000x xxxxb *) - | MODE_SRT e ⇒ opt_map … (memory_filter_write m t s 〈〈x0,x0〉:(b8_of_bit e)〉 writeb) - (λtmps.Some ? (pair … tmps cur_pc)) ] - (* scrittura di una word *) - | false ⇒ λs:any_status m t.λcur_pc:word16.λi:instr_mode.λwritew:word16.match i with -(* NO: non ci sono indicazioni *) - [ MODE_INH ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHA ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHX ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_INHH ⇒ None ? - -(* NO: solo lettura word *) - | MODE_INHX0ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX1ADD ⇒ None ? -(* NO: solo lettura word *) - | MODE_INHX2ADD ⇒ None ? - -(* NO: solo lettura byte *) - | MODE_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM1EXT ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM2 ⇒ None ? -(* scrive 1 word su indirizzo diretto 1 byte *) - | MODE_DIR1 ⇒ mode_DIR1_write false m t s cur_pc writew -(* scrive 1 word su indirizzo diretto 1 word *) - | MODE_DIR2 ⇒ mode_DIR2_write false m t s cur_pc writew -(* scrive 1 word su H:X *) - | MODE_IX0 ⇒ mode_IX0_write false m t s cur_pc writew -(* scrive 1 word su H:X+1 byte offset *) - | MODE_IX1 ⇒ mode_IX1_write false m t s cur_pc writew -(* scrive 1 word su H:X+1 word offset *) - | MODE_IX2 ⇒ mode_IX2_write false m t s cur_pc writew -(* scrive 1 word su SP+1 byte offset *) - | MODE_SP1 ⇒ mode_SP1_write false m t s cur_pc writew -(* scrive 1 word su SP+1 word offset *) - | MODE_SP2 ⇒ mode_SP2_write false m t s cur_pc writew - -(* NO: solo lettura/scrittura byte *) - | MODE_DIR1_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_IMM1_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_IX0p_to_DIR1 ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_DIR1_to_IX0p ⇒ None ? - -(* NO: solo lettura word/scrittura byte *) - | MODE_INHA_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_INHX_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IMM1_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_DIR1_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_IX0_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IX0p_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_IX1_and_IMM1 ⇒ None ? -(* NO: solo lettura word *) - | MODE_IX1p_and_IMM1 ⇒ None ? -(* NO: solo lettura word/scrittura byte *) - | MODE_SP1_and_IMM1 ⇒ None ? - -(* NO: solo scrittura byte *) - | MODE_DIRn _ ⇒ None ? -(* NO: solo lettura word *) - | MODE_DIRn_and_IMM1 _ ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_TNY _ ⇒ None ? -(* NO: solo lettura/scrittura byte *) - | MODE_SRT _ ⇒ None ? - ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/model.ma b/helm/software/matita/contribs/ng_assembly/freescale/model.ma deleted file mode 100755 index fe01726c7..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/model.ma +++ /dev/null @@ -1,357 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/status.ma". - -(* *********************************** *) -(* IMPOSTAZIONI SPECIFICHE DEI MODELLI *) -(* *********************************** *) - -(* modelli di HC05 *) -ninductive HC05_mcu_model : Type ≝ - MC68HC05J5A: HC05_mcu_model - (*..*). - -(* modelli di HC08 *) -ninductive HC08_mcu_model : Type ≝ - MC68HC08AB16A: HC08_mcu_model - (*..*). - -(* modelli di HCS08 *) -ninductive HCS08_mcu_model : Type ≝ - MC9S08AW60 : HCS08_mcu_model -| MC9S08GB60 : HCS08_mcu_model - (*..*). - -(* modelli di RS08 *) -ninductive RS08_mcu_model : Type ≝ - MC9RS08KA1 : RS08_mcu_model -| MC9RS08KA2 : RS08_mcu_model. - -(* raggruppamento dei modelli *) -ninductive any_mcu_model : Type ≝ - FamilyHC05 : HC05_mcu_model → any_mcu_model -| FamilyHC08 : HC08_mcu_model → any_mcu_model -| FamilyHCS08 : HCS08_mcu_model → any_mcu_model -| FamilyRS08 : RS08_mcu_model → any_mcu_model. - -(* -condizioni errore interne alla MCU -(Il programma viene caricato dal produttore in ROM o impostato in EEPROM) -HC05: +illegal address during opcode fetch -HC08: +illegal address duting opcode fetch (ILAD mascherabile) - +illegal opcode (ILOP mascherabile) - -(Il programma viene programmato nella FLASH) -HCS08: +illegal address during opcode fetch (ILAD mascherabile) - +illegal opcode (ILOP mascherabile) - +security = accesso a RAM e zone FLASH dichiarate sicure da zone sicure - da' 0 in lettura e ignore in scrittura, [FLASH]SEC00:SEC01 (1,0) - corrisponde a OFF, altre ON, disattivabile solo da modalita' sicura se - opzione [FLASH]KEYEN e' 1 passando chiave a 8byte da modalita' sicura. - Altrimenti disattivabile solo con FLASH mass erase. Obbiettivo - e' impedire duplicazione di software di controllo, dato che esiste - modalita' debugging. A restart viene ricaricata da FLASH impostazione - sicurezza! -RS08: +illegal address durting opcode fetch (ILAD) mascherabile - +illegal opcode (ILOP mascherabile) - +security = solo la FLASH e' considerata sicura. Stesso meccanismo di HCS08 - ma governato solo da [FLASH]SECD (0) OFF.Una volta attivato l'unica - disattivazione e' la cancellazione della FLASH. -*) - -(* memoria degli HC05 *) -ndefinition memory_type_of_FamilyHC05 ≝ -λm:HC05_mcu_model.match m with - [ MC68HC05J5A ⇒ - [ - (* astraggo molto *) - (* 0x0000-0x001F,0x0FF0: sarebbe memory mapped IO *) - - triple … 〈〈x0,x0〉:〈x8,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 MEM_READ_WRITE (* 128B RAM+STACK *) - ; triple … 〈〈x0,x3〉:〈x0,x0〉〉 〈〈x0,xC〉:〈xF,xF〉〉 MEM_READ_ONLY (* 2560B USER ROM *) - ; triple … 〈〈x0,xE〉:〈x0,x0〉〉 〈〈x0,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 512B INTERNAL ROM *) - ] - (*..*) - ]. - -(* memoria degli HC08 *) -ndefinition memory_type_of_FamilyHC08 ≝ -λm:HC08_mcu_model.match m with - [ MC68HC08AB16A ⇒ - [ - (* astraggo molto *) - (* 0x0000-0x004F,0xFE00-0xFE01,0xFE03, - 0xFE0C-0xFE11,0xFE1A-0xFE1D,0xFE1F: sarebbe memory mapped IO *) - (* 0x0500-0x057F,0xFE02,0xFE04-0xFE07, - 0xFE09-0xFE0B,0xFE12-0xFE19,0xFE1E,0xFFC0-0xFFCF : sarebbe reserved *) - - triple … 〈〈x0,x0〉:〈x5,x0〉〉 〈〈x0,x2〉:〈x4,xF〉〉 MEM_READ_WRITE (* 512B RAM *) - ; triple … 〈〈x0,x8〉:〈x0,x0〉〉 〈〈x0,x9〉:〈xF,xF〉〉 MEM_READ_ONLY (* 512B EEPROM *) - ; triple … 〈〈xB,xE〉:〈x0,x0〉〉 〈〈xF,xD〉:〈xF,xF〉〉 MEM_READ_ONLY (* 16384B ROM *) - ; triple … 〈〈xF,xE〉:〈x2,x0〉〉 〈〈xF,xF〉:〈x5,x2〉〉 MEM_READ_ONLY (* 307B ROM *) - ; triple … 〈〈xF,xF〉:〈xD,x0〉〉 〈〈xF,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 48B ROM *) ] - (*..*) - ]. - -(* memoria degli HCS08 *) -ndefinition memory_type_of_FamilyHCS08 ≝ -λm:HCS08_mcu_model.match m with - [ MC9S08AW60 ⇒ - [ - (* astraggo molto *) - (* 0x0000-0x006F,0x1800-0x185F: sarebbe memory mapped IO *) - - triple … 〈〈x0,x0〉:〈x7,x0〉〉 〈〈x0,x8〉:〈x6,xF〉〉 MEM_READ_WRITE (* 2048B RAM *) - ; triple … 〈〈x0,x8〉:〈x7,x0〉〉 〈〈x1,x7〉:〈xF,xF〉〉 MEM_READ_ONLY (* 3984B FLASH *) - ; triple … 〈〈x1,x8〉:〈x6,x0〉〉 〈〈xF,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 59296B FLASH *) ] - | MC9S08GB60 ⇒ - [ - (* astraggo molto *) - (* 0x0000-0x006F,0x1800-0x185F: sarebbe memory mapped IO *) - - triple … 〈〈x0,x0〉:〈x8,x0〉〉 〈〈x1,x0〉:〈x7,xF〉〉 MEM_READ_WRITE (* 4096B RAM *) - ; triple … 〈〈x1,x0〉:〈x8,x0〉〉 〈〈x1,x7〉:〈xF,xF〉〉 MEM_READ_ONLY (* 1920B FLASH *) - ; triple … 〈〈x1,x8〉:〈x2,xC〉〉 〈〈xF,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 59348B FLASH *) ] - ]. - -(* memoria dei RS08 *) -ndefinition memory_type_of_FamilyRS08 ≝ -λm:RS08_mcu_model.match m with - [ MC9RS08KA1 ⇒ - [ - triple … 〈〈x0,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,xE〉〉 MEM_READ_WRITE (* 15B RAM *) - (* [000F] e' il registro X *) - (* 0x0010-0x001E sarebbe memory mapped IO, proviamo per completezza con RAM *) - ; triple … 〈〈x0,x0〉:〈x1,x0〉〉 〈〈x0,x0〉:〈x1,xE〉〉 MEM_READ_WRITE (* 15B MEMORY MAPPED IO *) - (* [001F] e' il registro PAGESEL *) - ; triple … 〈〈x0,x0〉:〈x2,x0〉〉 〈〈x0,x0〉:〈x4,xF〉〉 MEM_READ_WRITE (* 48B RAM *) - (* [00C0-00FF] mappato da PAGESEL su [00pp pppp ppxx xxxx] *) - ; triple … 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 MEM_READ_WRITE (* 64B RAM PAGING *) - (* 0x0200-0x023F sarebbe memory mapped IO, proviamo per completezza con RAM *) - ; triple … 〈〈x0,x2〉:〈x0,x0〉〉 〈〈x0,x2〉:〈x3,xF〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *) - ; triple … 〈〈x3,xC〉:〈x0,x0〉〉 〈〈x3,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 1024B FLASH *) ] - | MC9RS08KA2 ⇒ - [ - triple … 〈〈x0,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,xE〉〉 MEM_READ_WRITE (* 15B RAM *) - (* [000F] e' il registro X *) - (* 0x0010-0x001E sarebbe memory mapped IO, proviamo per completezza con RAM *) - ; triple … 〈〈x0,x0〉:〈x1,x0〉〉 〈〈x0,x0〉:〈x1,xE〉〉 MEM_READ_WRITE (* 15B MEMORY MAPPED IO *) - (* [001F] e' il registro PAGESEL *) - ; triple … 〈〈x0,x0〉:〈x2,x0〉〉 〈〈x0,x0〉:〈x4,xF〉〉 MEM_READ_WRITE (* 48B RAM *) - (* [00C0-00FF] mappato da PAGESEL su [00pp pppp ppxx xxxx] *) - ; triple … 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,x0〉:〈xF,xF〉〉 MEM_READ_WRITE (* 64B RAM PAGING *) - (* 0x0200-0x023F sarebbe memory mapped IO, proviamo per completezza con RAM *) - ; triple … 〈〈x0,x2〉:〈x0,x0〉〉 〈〈x0,x2〉:〈x3,xF〉〉 MEM_READ_WRITE (* 64B MEMORY MAPPED IO *) - ; triple … 〈〈x3,x8〉:〈x0,x0〉〉 〈〈x3,xF〉:〈xF,xF〉〉 MEM_READ_ONLY (* 2048B FLASH *) ] - ]. - -(* ∀modello.descrizione della memoria installata *) -ndefinition memory_type_of_mcu_version ≝ -λmcu:any_mcu_model.match mcu with - [ FamilyHC05 m ⇒ memory_type_of_FamilyHC05 m - | FamilyHC08 m ⇒ memory_type_of_FamilyHC08 m - | FamilyHCS08 m ⇒ memory_type_of_FamilyHCS08 m - | FamilyRS08 m ⇒ memory_type_of_FamilyRS08 m - ]. - -(* dato un modello costruisce un descrittore a partire dalla lista precedente *) -nlet rec build_memory_type_of_mcu_version_aux t param (result:aux_chk_type t) on param ≝ - match param with - [ nil ⇒ result - | cons hd tl ⇒ - build_memory_type_of_mcu_version_aux t tl - (check_update_ranged t result (fst3T ??? hd) (snd3T ??? hd) (thd3T ??? hd)) ]. - -ndefinition build_memory_type_of_mcu_version ≝ -λmcu:any_mcu_model.λt:memory_impl. - build_memory_type_of_mcu_version_aux t (memory_type_of_mcu_version mcu) (out_of_bound_memory t). - -(* sarebbe programma da caricare/zero_memory, ora test *) -ndefinition memory_of_mcu_version ≝ -λmcu:any_mcu_model.λt:memory_impl.match mcu with - [ FamilyHC05 m ⇒ match m with - [ MC68HC05J5A ⇒ zero_memory t - (*..*) - ] - | FamilyHC08 m ⇒ match m with - [ MC68HC08AB16A ⇒ zero_memory t - (*..*) - ] - (* tralascio l'enumerazione dei casi, per ora e' tutto 0 *) - | FamilyHCS08 _ ⇒ zero_memory t - | FamilyRS08 _ ⇒ zero_memory t - ]. - -(* - parametrizzati i non deterministici rispetto a tutti i valori casuali - che verranno dati dall'esterno di tipo byte8 (ndby1-2) e bool (ndbo1-5). - l'ACCENSIONE e' totalmente equivalente ad un reset causato da calo di tensione - (reset V-low), la memoria ed il check puo' essere passata, per esempio da - - (memory_of_mcu_version MC68HC05J5A) - - (build_memory_type_of_mcu_version MC68HC05J5A) -*) -ndefinition start_of_mcu_version_HC05 ≝ -λmcu:HC05_mcu_model.λt:memory_impl. -λmem:aux_mem_type t.λchk:aux_chk_type t. -λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. - let build ≝ λspm,spf,pcm:word16. - let fetched_pc ≝ mk_word16 (mem_read_abs t mem (and_w16 〈〈xF,xF〉:〈xF,xE〉〉 pcm)) - (mem_read_abs t mem (and_w16 〈〈xF,xF〉:〈xF,xF〉〉 pcm)) in - mk_any_status HC05 t - (mk_alu_HC05 - (* acc_low: ? *) ndby1 (* indx_low: ? *) ndby2 - (* sp: reset *) (or_w16 (and_w16 〈〈x0,x0〉:〈xF,xF〉〉 spm) spf) spm spf - (* pc: reset+fetch *) (and_w16 fetched_pc pcm) pcm - (* H: ? *) ndbo1 (* I: reset *) true (* N: ? *) ndbo2 - (* Z: ? *) ndbo3 (* C: ? *) ndbo4 (* IRQ: ? *) irqfl) - (* mem *) mem - (* chk *) chk - (* clk: reset *) (None ?) in - match mcu with - [ MC68HC05J5A ⇒ build 〈〈x0,x0〉:〈x3,xF〉〉 〈〈x0,x0〉:〈xC,x0〉〉 〈〈x0,xF〉:〈xF,xF〉〉 - (*..*) - ]. - -ndefinition start_of_mcu_version_HC08 ≝ -λmcu:HC08_mcu_model.λt:memory_impl. -λmem:aux_mem_type t.λchk:aux_chk_type t. -λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. - let fetched_pc ≝ mk_word16 (mem_read_abs t mem 〈〈xF,xF〉:〈xF,xE〉〉) - (mem_read_abs t mem 〈〈xF,xF〉:〈xF,xF〉〉) in - mk_any_status HC08 t - (mk_alu_HC08 - (* acc_low: ? *) ndby1 (* indw_low: ? *) ndby2 (* indx_high: reset *) 〈x0,x0〉 - (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 (* pc: reset+fetch *) fetched_pc - (* V: ? *) ndbo1 (* H: ? *) ndbo2 (* I: reset *) true - (* N: ? *) ndbo3 (* Z: ? *) ndbo4 (* C: ? *) ndbo5 (* IRQ: ? *) irqfl) - (* mem *) mem - (* chk *) chk - (* clk: reset *) (None ?). - -ndefinition start_of_mcu_version_HCS08 ≝ -λmcu:HCS08_mcu_model.λt:memory_impl. -λmem:aux_mem_type t.λchk:aux_chk_type t. -λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. - let fetched_pc ≝ mk_word16 (mem_read_abs t mem 〈〈xF,xF〉:〈xF,xE〉〉) - (mem_read_abs t mem 〈〈xF,xF〉:〈xF,xF〉〉) in - mk_any_status HCS08 t - (mk_alu_HC08 - (* acc_low: ? *) ndby1 (* indw_low: ? *) ndby2 (* indx_high: reset *) 〈x0,x0〉 - (* sp: reset *) 〈〈x0,x0〉:〈xF,xF〉〉 (* pc: reset+fetch *) fetched_pc - (* V: ? *) ndbo1 (* H: ? *) ndbo2 (* I: reset *) true - (* N: ? *) ndbo3 (* Z: ? *) ndbo4 (* C: ? *) ndbo5 (* IRQ: ? *) irqfl) - (* mem *) mem - (* chk *) chk - (* clk: reset *) (None ?). - -ndefinition start_of_mcu_version_RS08 ≝ -λmcu:RS08_mcu_model.λt:memory_impl. -λmem:aux_mem_type t.λchk:aux_chk_type t. -λndby1,ndby2:byte8.λirqfl,ndbo1,ndbo2,ndbo3,ndbo4,ndbo5:bool. - let build ≝ λpcm. - mk_any_status RS08 t - (mk_alu_RS08 - (* acc_low: reset *) 〈x0,x0〉 - (* pc: reset *) (and_w16 〈〈xF,xF〉:〈xF,xD〉〉 pcm) pcm - (* spc: reset *) (and_w16 〈〈xF,xF〉:〈xF,xD〉〉 pcm) - (* xm: reset *) 〈x0,x0〉 (* psm: *) 〈x8,x0〉 - (* Z: reset *) false (* C: reset *) false) - (* mem *) mem - (* chk *) chk - (* clk: reset *) (None ?) in - (* tralascio l'enumerazione dei casi, tanto i valori sono uguali *) - build 〈〈x3,xF〉:〈xF,xF〉〉. - -(* - cio' che non viene resettato mantiene il valore precedente: nella documentazione - viene riportato come "unaffected"/"indeterminate"/"unpredictable" - il soft RESET e' diverso da un calo di tensione e la ram non variera' -*) -ndefinition reset_of_mcu ≝ -λm:mcu_type.λt:memory_impl. -let pc_reset_h ≝ 〈〈xF,xF〉:〈xF,xE〉〉 in -let pc_reset_l ≝ 〈〈xF,xF〉:〈xF,xF〉〉 in -let pc_RS08_reset ≝ 〈〈xF,xF〉:〈xF,xD〉〉 in -let sp_reset ≝ 〈〈x0,x0〉:〈xF,xF〉〉 in - match m return λm:mcu_type.(any_status m t) → (any_status m t) with -(* HC05: parzialmente non deterministico *) - [ HC05 ⇒ λs:any_status HC05 t.match s with - [ mk_any_status alu mem chk clk ⇒ match alu with - [ mk_alu_HC05 acclow indxlow _ spm spf _ pcm hfl _ nfl zfl cfl irqfl ⇒ - let fetched_pc ≝ mk_word16 (mem_read_abs t mem (and_w16 pc_reset_h pcm)) - (mem_read_abs t mem (and_w16 pc_reset_l pcm)) in - mk_any_status HC05 t - (mk_alu_HC05 - (* acc_low: inv. *) acclow (* indx_low: inv. *) indxlow - (* sp: reset *) (or_w16 (and_w16 sp_reset spm) spf) spm spf - (* pc: reset+fetch *) (and_w16 fetched_pc pcm) pcm - (* H: inv. *) hfl (* I: reset *) true (* N: inv. *) nfl - (* Z: inv. *) zfl (* C: inv. *) cfl (* IRQ: inv *) irqfl) - (* mem: inv. *) mem - (* chk: inv. *) chk - (* clk: reset *) (None ?) ]] -(* HC08: parzialmente non deterministico *) - | HC08 ⇒ λs:any_status HC08 t.match s with - [ mk_any_status alu mem chk clk ⇒ match alu with - [ mk_alu_HC08 acclow indxlow _ _ _ vfl hfl _ nfl zfl cfl irqfl ⇒ - let fetched_pc ≝ mk_word16 (mem_read_abs t mem pc_reset_h) - (mem_read_abs t mem pc_reset_l) in - mk_any_status HC08 t - (mk_alu_HC08 - (* acc_low: inv. *) acclow (* indx_low: inv. *) indxlow (* indx_high: reset *) 〈x0,x0〉 - (* sp: reset *) sp_reset (* pc: reset+fetch *) fetched_pc - (* V: inv. *) vfl (* H: inv. *) hfl (* I: reset *) true - (* N: inv. *) nfl (* Z: inv. *) zfl (* C: inv. *) cfl (* IRQ: inv *) irqfl) - (* mem: inv. *) mem - (* chk: inv. *) chk - (* clk: reset *) (None ?) ]] -(* HCS08: parzialmente non deterministico *) - | HCS08 ⇒ λs:any_status HCS08 t.match s with - [ mk_any_status alu mem chk clk ⇒ match alu with - [ mk_alu_HC08 acclow indxlow _ _ _ vfl hfl _ nfl zfl cfl irqfl ⇒ - let fetched_pc ≝ mk_word16 (mem_read_abs t mem pc_reset_h) - (mem_read_abs t mem pc_reset_l) in - mk_any_status HCS08 t - (mk_alu_HC08 - (* acc_low: inv. *) acclow (* indx_low: inv. *) indxlow (* indx_high: reset *) 〈x0,x0〉 - (* sp: reset *) sp_reset (* pc: reset+fetch *) fetched_pc - (* V: inv. *) vfl (* H: inv. *) hfl (* I: reset *) true - (* N: inv. *) nfl (* Z: inv. *) zfl (* C: inv. *) cfl (* IRQ: inv *) irqfl) - (* mem: inv. *) mem - (* chk: inv. *) chk - (* clk: reset *) (None ?) ]] -(* RS08: deterministico *) - | RS08 ⇒ λs:any_status RS08 t.match s with - [ mk_any_status alu mem chk clk ⇒ match alu with - [ mk_alu_RS08 _ _ pcm _ _ _ _ _ ⇒ - mk_any_status RS08 t - (mk_alu_RS08 - (* acc_low: reset *) 〈x0,x0〉 - (* pc: reset *) (and_w16 pc_RS08_reset pcm) pcm - (* spc: reset *) (and_w16 pc_RS08_reset pcm) - (* xm: reset *) 〈x0,x0〉 (* psm: reset *) 〈x8,x0〉 - (* Z: reset *) false (* C: reset *) false) - (* mem: inv. *) mem - (* chk: inv. *) chk - (* clk: reset *) (None ?) ]] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/multivm.ma b/helm/software/matita/contribs/ng_assembly/freescale/multivm.ma deleted file mode 100755 index 44dacea60..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/multivm.ma +++ /dev/null @@ -1,1307 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/load_write.ma". - -(* ************************************************ *) -(* LOGICHE AUSILIARE CHE ACCOMUNANO PIU' OPERAZIONI *) -(* ************************************************ *) - -(* NB: dentro il codice i commenti cercano di spiegare la logica - secondo quanto riportato dalle specifiche delle mcu *) - -(* NB: notare che tranne nei casi in cui PC viene modificato esplicitamente - il suo avanzamento viene delegato totalmente agli strati inferiori - I) avanzamento dovuto al decode degli op (fetch) - II) avanzamento dovuto al caricamento degli argomenti (multi_mode_load/write) - la modifica effettiva avviene poi centralizzata in tick *) - -(* A = [true] fAMC(A,M,C), [false] A *) -(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) -(* fAMC e' la logica da applicare: somma con/senza carry *) -ndefinition execute_ADC_ADD_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λsetflag:bool. -λfAMC:byte8 → byte8 → bool → ProdT byte8 bool. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - let A_op ≝ get_acc_8_low_reg m t s_tmp1 in - match fAMC A_op M_op (get_c_flag m t s_tmp1) with - [ pair R_op carry ⇒ - let A7 ≝ MSB_b8 A_op in let M7 ≝ MSB_b8 M_op in let R7 ≝ MSB_b8 R_op in - let A3 ≝ MSB_ex (b8l A_op) in let M3 ≝ MSB_ex (b8l M_op) in let R3 ≝ MSB_ex (b8l R_op) in - (* A = [true] fAMC(A,M,C), [false] A *) - let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg m t s_tmp1 R_op | false ⇒ s_tmp1 ] in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 R_op 〈x0,x0〉) in - (* C = A7&M7 | M7&nR7 | nR7&A7 *) - let s_tmp4 ≝ set_c_flag m t s_tmp3 ((A7⊗M7) ⊕ (M7⊗(⊖R7)) ⊕ ((⊖R7)⊗A7)) in - (* N = R7 *) - let s_tmp5 ≝ setweak_n_flag m t s_tmp4 R7 in - (* H = A3&M3 | M3&nR3 | nR3&A3 *) - let s_tmp6 ≝ setweak_h_flag m t s_tmp5 ((A3⊗M3) ⊕ (M3⊗(⊖R3)) ⊕ ((⊖R3)⊗A3)) in - (* V = A7&M7&nR7 | nA7&nM7&R7 *) - let s_tmp7 ≝ setweak_v_flag m t s_tmp6 ((A7⊗M7⊗(⊖R7)) ⊕ ((⊖A7)⊗(⊖M7)⊗R7)) in - (* newpc = nextpc *) - Some ? (pair … s_tmp7 new_pc) ]]). - -(* A = [true] fAM(A,M), [false] A *) -(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) -(* fAM e' la logica da applicare: and/xor/or *) -ndefinition execute_AND_BIT_EOR_ORA_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λsetflag:bool. -λfAM:byte8 → byte8 → byte8. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - let R_op ≝ fAM (get_acc_8_low_reg m t s_tmp1) M_op in - (* A = [true] fAM(A,M), [false] A *) - let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg m t s_tmp1 R_op | false ⇒ s_tmp1 ] in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 R_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_b8 R_op) in - (* V = 0 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc) ]). - -(* M = fMC(M,C) *) -(* fMC e' la logica da applicare: rc_/ro_/sh_ *) -ndefinition execute_ASL_ASR_LSR_ROL_ROR_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. -λfMC:byte8 → bool → ProdT byte8 bool. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op _ ⇒ - match fMC M_op (get_c_flag m t s_tmp1) with [ pair R_op carry ⇒ - (* M = fMC(M,C) *) - opt_map … (multi_mode_write true m t s_tmp1 cur_pc i R_op) - (λS_PC.match S_PC with - [ pair s_tmp2 new_pc ⇒ - (* C = carry *) - let s_tmp3 ≝ set_c_flag m t s_tmp2 carry in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp4 ≝ set_z_flag m t s_tmp3 (eq_b8 R_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp5 ≝ setweak_n_flag m t s_tmp4 (MSB_b8 R_op) in - (* V = R7 ⊙ carry *) - let s_tmp6 ≝ setweak_v_flag m t s_tmp5 ((MSB_b8 R_op) ⊙ carry) in - (* newpc = nextpc *) - Some ? (pair … s_tmp6 new_pc) ])]]). - -(* estensione del segno byte → word *) -ndefinition byte_extension ≝ -λb:byte8.〈match MSB_b8 b with [ true ⇒ 〈xF,xF〉 | false ⇒ 〈x0,x0〉 ]:b〉. - -(* branch con byte+estensione segno *) -ndefinition branched_pc ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcur_pc:word16.λb:byte8. - get_pc_reg m t (set_pc_reg m t s (plus_w16_d_d cur_pc (byte_extension b))). - -(* if COND=1 branch *) -(* tutti i branch calcoleranno la condizione e la passeranno qui *) -ndefinition execute_any_BRANCH ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λfCOND:bool. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - (* if true, branch *) - match fCOND with - (* newpc = nextpc + rel *) - [ true ⇒ Some ? (pair … s_tmp1 (branched_pc m t s_tmp1 new_pc M_op)) - (* newpc = nextpc *) - | false ⇒ Some ? (pair … s_tmp1 new_pc) ]]). - -(* Mn = filtered optval *) -(* il chiamante passa 0x00 per azzerare, 0xFF per impostare il bit di M *) -ndefinition execute_BCLRn_BSETn_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λoptval:byte8. - (* Mn = filtered optval *) - opt_map … (multi_mode_write true m t s cur_pc i optval) - (λS_PC.match S_PC with - (* newpc = nextpc *) - [ pair s_tmp1 new_pc ⇒ Some ? (pair … s_tmp1 new_pc) ]). - -(* if COND(Mn) branch *) -(* il chiamante passa la logica da testare (0x00,¬0x00) e poi si salta *) -ndefinition execute_BRCLRn_BRSETn_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λfCOND:byte8 → bool. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ match M_op with - [ mk_word16 MH_op ML_op ⇒ - (* if COND(Mn) branch *) - match fCOND MH_op with - (* newpc = nextpc + rel *) - [ true ⇒ Some ? (pair … s_tmp1 (branched_pc m t s_tmp1 new_pc ML_op)) - (* newpc = nextpc *) - | false ⇒ Some ? (pair … s_tmp1 new_pc) ]]]). - -(* M = fM(M) *) -(* fM e' la logica da applicare: not/neg/++/-- *) -ndefinition execute_COM_DEC_INC_NEG_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. -λfM:byte8 → byte8.λfV:bool → bool → bool.λfC:bool → byte8 → bool. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op _ ⇒ - let R_op ≝ fM M_op in - (* M = fM(M) *) - opt_map … (multi_mode_write true m t s_tmp1 cur_pc i R_op) - (λS_PC.match S_PC with - [ pair s_tmp2 new_pc ⇒ - (* C = fCR (C,R) *) - let s_tmp3 ≝ set_c_flag m t s_tmp2 (fC (get_c_flag m t s_tmp2) R_op) in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp4 ≝ set_z_flag m t s_tmp3 (eq_b8 R_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp5 ≝ setweak_n_flag m t s_tmp4 (MSB_b8 R_op) in - (* V = fV (M7,R7) *) - let s_tmp6 ≝ setweak_v_flag m t s_tmp5 (fV (MSB_b8 M_op) (MSB_b8 R_op)) in - (* newpc = nextpc *) - Some ? (pair … s_tmp6 new_pc) ])]). - -(* A = [true] fAMC(A,M,C), [false] A *) -(* cioe' in caso di false l'operazione viene eseguita ma modifica solo i flag *) -(* fAMC e' la logica da applicare: sottrazione con/senza carry *) -ndefinition execute_SBC_SUB_aux ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16.λsetflag:bool. -λfAMC:byte8 → byte8 → bool → ProdT byte8 bool. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - let A_op ≝ get_acc_8_low_reg m t s_tmp1 in - match fAMC A_op M_op (get_c_flag m t s_tmp1) with - [ pair R_op carry ⇒ - let A7 ≝ MSB_b8 A_op in let M7 ≝ MSB_b8 M_op in let R7 ≝ MSB_b8 R_op in - (* A = [true] fAMC(A,M,C), [false] A *) - let s_tmp2 ≝ match setflag with [ true ⇒ set_acc_8_low_reg m t s_tmp1 R_op | false ⇒ s_tmp1 ] in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 R_op 〈x0,x0〉) in - (* C = nA7&M7 | M7&R7 | R7&nA7 *) - let s_tmp4 ≝ set_c_flag m t s_tmp3 (((⊖A7)⊗M7) ⊕ (M7⊗R7) ⊕ (R7⊗(⊖A7))) in - (* N = R7 *) - let s_tmp5 ≝ setweak_n_flag m t s_tmp4 R7 in - (* V = A7&nM7&nR7 | nA7&M7&R7 *) - let s_tmp6 ≝ setweak_v_flag m t s_tmp5 ((A7⊗(⊖M7)⊗(⊖R7)) ⊕ ((⊖A7)⊗M7⊗R7)) in - (* newpc = nextpc *) - Some ? (pair … s_tmp6 new_pc) ]]). - -(* il classico push *) -ndefinition aux_push ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λval:byte8. - opt_map … (get_sp_reg m t s) - (* [SP] = val *) - (λSP_op.opt_map … (memory_filter_write m t s SP_op val) - (* SP -- *) - (λs_tmp1.opt_map … (set_sp_reg m t s_tmp1 (pred_w16 SP_op)) - (λs_tmp2.Some ? s_tmp2))). - -(* il classico pop *) -(* NB: l'incremento di SP deve essere filtrato dalla ALU, quindi get(set(SP)) *) -ndefinition aux_pop ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - opt_map … (get_sp_reg m t s) - (* SP ++ *) - (λSP_op.opt_map … (set_sp_reg m t s (succ_w16 SP_op)) - (λs_tmp1.opt_map … (get_sp_reg m t s_tmp1) - (* val = [SP] *) - (λSP_op'.opt_map … (memory_filter_read m t s_tmp1 SP_op') - (λval.Some ? (pair … s_tmp1 val))))). - -(* CCR corrisponde a V11HINZC e cmq 1 se un flag non esiste *) -(* i flag mantengono posizione costante nelle varie ALU, e se non sono - implementati corrispondono a 1 *) -ndefinition aux_get_CCR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. -let V_comp ≝ match get_v_flag m t s with - [ None ⇒ 〈x8,x0〉 | Some V_val ⇒ match V_val with [ true ⇒ 〈x8,x0〉 | false ⇒ 〈x0,x0〉 ]] in -let H_comp ≝ match get_h_flag m t s with - [ None ⇒ 〈x1,x0〉 | Some H_val ⇒ match H_val with [ true ⇒ 〈x1,x0〉 | false ⇒ 〈x0,x0〉 ]] in -let I_comp ≝ match get_i_flag m t s with - [ None ⇒ 〈x0,x8〉 | Some I_val ⇒ match I_val with [ true ⇒ 〈x0,x8〉 | false ⇒ 〈x0,x0〉 ]] in -let N_comp ≝ match get_n_flag m t s with - [ None ⇒ 〈x0,x4〉 | Some N_val ⇒ match N_val with [ true ⇒ 〈x0,x4〉 | false ⇒ 〈x0,x0〉 ]] in -let Z_comp ≝ match get_z_flag m t s with - [ true ⇒ 〈x0,x2〉 | false ⇒ 〈x0,x0〉 ] in -let C_comp ≝ match get_c_flag m t s with - [ true ⇒ 〈x0,x1〉 | false ⇒ 〈x0,x0〉 ] in -or_b8 〈x6,x0〉 (or_b8 V_comp (or_b8 H_comp (or_b8 I_comp (or_b8 N_comp (or_b8 Z_comp C_comp))))). - -(* CCR corrisponde a V11HINZC *) -(* i flag mantengono posizione costante nelle varie ALU, e se non sono - implementati si puo' usare tranquillamente setweak *) -ndefinition aux_set_CCR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λCCR:byte8. - let s_tmp1 ≝ set_c_flag m t s (eq_b8 〈x0,x1〉 (and_b8 〈x0,x1〉 CCR)) in - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 〈x0,x2〉 (and_b8 〈x0,x2〉 CCR)) in - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 (eq_b8 〈x0,x4〉 (and_b8 〈x0,x4〉 CCR)) in - let s_tmp4 ≝ setweak_i_flag m t s_tmp3 (eq_b8 〈x0,x8〉 (and_b8 〈x0,x8〉 CCR)) in - let s_tmp5 ≝ setweak_h_flag m t s_tmp4 (eq_b8 〈x1,x0〉 (and_b8 〈x1,x0〉 CCR)) in - let s_tmp6 ≝ setweak_v_flag m t s_tmp5 (eq_b8 〈x8,x0〉 (and_b8 〈x8,x0〉 CCR)) in - s_tmp6. - -(* **************** *) -(* LOGICA DELLA ALU *) -(* **************** *) - -(* A = A + M + C *) -ndefinition execute_ADC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ADC_ADD_aux m t s i cur_pc true (λA_op.λM_op.λC_op.plus_b8_dc_dc A_op M_op C_op). - -(* A = A + M *) -ndefinition execute_ADD ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ADC_ADD_aux m t s i cur_pc true (λA_op.λM_op.λC_op.plus_b8_dc_dc A_op M_op false). - -(* SP += extended M *) -ndefinition execute_AIS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (get_sp_reg m t s_tmp1) - (* SP += extended M *) - (λSP_op.opt_map … (set_sp_reg m t s_tmp1 (plus_w16_d_d SP_op (byte_extension M_op))) - (λs_tmp2.Some ? (pair … s_tmp2 new_pc))) ]). - -(* H:X += extended M *) -ndefinition execute_AIX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (get_indX_16_reg m t s_tmp1) - (* H:X += extended M *) - (λHX_op.opt_map … (set_indX_16_reg m t s_tmp1 (plus_w16_d_d HX_op (byte_extension M_op))) - (λs_tmp2.Some ? (pair … s_tmp2 new_pc))) ]). - -(* A = A & M *) -ndefinition execute_AND ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_AND_BIT_EOR_ORA_aux m t s i cur_pc true and_b8. - -(* M = C' <- rcl M <- 0 *) -ndefinition execute_ASL ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ASL_ASR_LSR_ROL_ROR_aux m t s i cur_pc (λM_op.λC_op.rcl_b8 M_op false). - -(* M = M7 -> rcr M -> C' *) -ndefinition execute_ASR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ASL_ASR_LSR_ROL_ROR_aux m t s i cur_pc (λM_op.λC_op.rcr_b8 M_op (MSB_b8 M_op)). - -(* if C=0, branch *) -ndefinition execute_BCC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc (⊖(get_c_flag m t s)). - -(* Mn = 0 *) -ndefinition execute_BCLRn ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_BCLRn_BSETn_aux m t s i cur_pc 〈x0,x0〉. - -(* if C=1, branch *) -ndefinition execute_BCS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc (get_c_flag m t s). - -(* if Z=1, branch *) -ndefinition execute_BEQ ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc (get_z_flag m t s). - -(* if N⊙V=0, branch *) -ndefinition execute_BGE ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.opt_map … (get_v_flag m t s) - (λV_op.execute_any_BRANCH m t s i cur_pc (⊖(N_op ⊙ V_op)))). - -(* BGND mode *) -ndefinition execute_BGND ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … s cur_pc). - -(* if Z|N⊙V=0, branch *) -ndefinition execute_BGT ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.opt_map … (get_v_flag m t s) - (λV_op.execute_any_BRANCH m t s i cur_pc (⊖((get_z_flag m t s) ⊕ (N_op ⊙ V_op))))). - -(* if H=0, branch *) -ndefinition execute_BHCC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_h_flag m t s) - (λH_op.execute_any_BRANCH m t s i cur_pc (⊖H_op)). - -(* if H=1, branch *) -ndefinition execute_BHCS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_h_flag m t s) - (λH_op.execute_any_BRANCH m t s i cur_pc H_op). - -(* if C|Z=0, branch *) -ndefinition execute_BHI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc (⊖((get_c_flag m t s) ⊕ (get_z_flag m t s))). - -(* if nIRQ=1, branch NB: irqflag e' un negato del pin *) -ndefinition execute_BIH ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_irq_flag m t s) - (λIRQ_op.execute_any_BRANCH m t s i cur_pc (⊖IRQ_op)). - -(* if nIRQ=0, branch NB: irqflag e' un negato del pin *) -ndefinition execute_BIL ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_irq_flag m t s) - (λIRQ_op.execute_any_BRANCH m t s i cur_pc IRQ_op). - -(* flags = A & M *) -ndefinition execute_BIT ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_AND_BIT_EOR_ORA_aux m t s i cur_pc false and_b8. - -(* if Z|N⊙V=1, branch *) -ndefinition execute_BLE ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.opt_map … (get_v_flag m t s) - (λV_op.execute_any_BRANCH m t s i cur_pc ((get_z_flag m t s) ⊕ (N_op ⊙ V_op)))). - -(* if C|Z=1, branch *) -ndefinition execute_BLS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc ((get_c_flag m t s) ⊕ (get_z_flag m t s)). - -(* if N⊙V=1, branch *) -ndefinition execute_BLT ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.opt_map … (get_v_flag m t s) - (λV_op.execute_any_BRANCH m t s i cur_pc (N_op ⊙ V_op))). - -(* if I=0, branch *) -ndefinition execute_BMC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_i_flag m t s) - (λI_op.execute_any_BRANCH m t s i cur_pc (⊖I_op)). - -(* if N=1, branch *) -ndefinition execute_BMI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.execute_any_BRANCH m t s i cur_pc N_op). - -(* if I=1, branch *) -ndefinition execute_BMS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_i_flag m t s) - (λI_op.execute_any_BRANCH m t s i cur_pc I_op). - -(* if Z=0, branch *) -ndefinition execute_BNE ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc (⊖(get_z_flag m t s)). - -(* if N=0, branch *) -ndefinition execute_BPL ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_n_flag m t s) - (λN_op.execute_any_BRANCH m t s i cur_pc (⊖N_op)). - -(* branch always *) -ndefinition execute_BRA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc true. - -(* if Mn=0 branch *) -ndefinition execute_BRCLRn ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_BRCLRn_BRSETn_aux m t s i cur_pc - (λMn_op.eq_b8 Mn_op 〈x0,x0〉). - -(* branch never... come se fosse un nop da 2 byte *) -ndefinition execute_BRN ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_any_BRANCH m t s i cur_pc false. - -(* if Mn=1 branch *) -ndefinition execute_BRSETn ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_BRCLRn_BRSETn_aux m t s i cur_pc - (λMn_op.⊖(eq_b8 Mn_op 〈x0,x0〉)). - -(* Mn = 1 *) -ndefinition execute_BSETn ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_BCLRn_BSETn_aux m t s i cur_pc 〈xF,xF〉. - -(* branch to subroutine *) -(* HC05/HC08/HCS08 si appoggiano allo stack, RS08 a SPC *) -ndefinition execute_BSR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t .λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ let aux ≝ - (* push (new_pc low) *) - opt_map … (aux_push m t s_tmp1 (w16l new_pc)) - (* push (new_pc high) *) - (λs_tmp2.opt_map … (aux_push m t s_tmp2 (w16h new_pc)) - (* new_pc = new_pc + rel *) - (λs_tmp3.Some ? (pair … s_tmp3 (branched_pc m t s_tmp3 new_pc M_op)))) - in match m with - [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux - | RS08 ⇒ - (* SPC = new_pc *) - opt_map … (set_spc_reg m t s_tmp1 new_pc) - (* new_pc = new_pc + rel *) - (λs_tmp2.Some ? (pair … s_tmp2 (branched_pc m t s_tmp2 new_pc M_op))) - ]]). - -(* if A=M, branch *) -ndefinition execute_CBEQA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - match M_op with - [ mk_word16 MH_op ML_op ⇒ - (* if A=M, branch *) - match eq_b8 (get_acc_8_low_reg m t s_tmp1) MH_op with - (* new_pc = new_pc + rel *) - [ true ⇒ Some ? (pair … s_tmp1 (branched_pc m t s_tmp1 new_pc ML_op)) - (* new_pc = new_pc *) - | false ⇒ Some ? (pair … s_tmp1 new_pc) - ]]]). - -(* if X=M, branch *) -ndefinition execute_CBEQX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - match M_op with - [ mk_word16 MH_op ML_op ⇒ - opt_map … (get_indX_8_low_reg m t s_tmp1) - (* if X=M, branch *) - (λX_op.match eq_b8 X_op MH_op with - (* new_pc = new_pc + rel *) - [ true ⇒ Some ? (pair … s_tmp1 (branched_pc m t s_tmp1 new_pc ML_op)) - (* new_pc = new_pc *) - | false ⇒ Some ? (pair … s_tmp1 new_pc) - ])]]). - -(* C = 0 *) -ndefinition execute_CLC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (set_c_flag m t s false) cur_pc). - -(* I = 0 *) -ndefinition execute_CLI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (set_i_flag m t s false) - (λs_tmp.Some ? (pair … s_tmp cur_pc)). - -(* M = 0 *) -ndefinition execute_CLR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* M = 0 *) - opt_map … (multi_mode_write true m t s cur_pc i 〈x0,x0〉) - (λS_PC.match S_PC with - [ pair s_tmp1 new_pc ⇒ - (* Z = 1 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 true in - (* N = 0 *) - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 false in - (* V = 0 *) - let s_tmp4 ≝ setweak_v_flag m t s_tmp3 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp4 new_pc) ]). - -(* flags = A - M *) -ndefinition execute_CMP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_SBC_SUB_aux m t s i cur_pc false (λA_op.λM_op.λC_op.plus_b8_dc_dc A_op (compl_b8 M_op) false). - -(* M = not M *) -ndefinition execute_COM ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_COM_DEC_INC_NEG_aux m t s i cur_pc not_b8 - (* fV = 0 *) - (λM7.λR7.false) - (* fC = 1 *) - (λC_op.λR_op.true). - -(* flags = H:X - M *) -ndefinition execute_CPHX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (get_indX_16_reg m t s_tmp1) - (λX_op. - match plus_w16_dc_dc X_op (compl_w16 M_op) false with - [ pair R_op carry ⇒ - let X15 ≝ MSB_w16 X_op in let M15 ≝ MSB_w16 M_op in let R15 ≝ MSB_w16 R_op in - (* Z = nR15&nR14&nR13&nR12&nR11&nR10&nR9&nR8&nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_w16 R_op 〈〈x0,x0〉:〈x0,x0〉〉) in - (* C = nX15&M15 | M15&R15 | R15&nX15 *) - let s_tmp3 ≝ set_c_flag m t s_tmp2 (((⊖X15)⊗M15) ⊕ (M15⊗R15) ⊕ (R15⊗(⊖X15))) in - (* N = R15 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 R15 in - (* V = X15&nM15&nR15 | nX15&M15&R15 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 ((X15⊗(⊖M15)⊗(⊖R15)) ⊕ ((⊖X15)⊗M15⊗R15)) in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc) ] ) ]). - -(* flags = X - M *) -ndefinition execute_CPX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (get_indX_8_low_reg m t s_tmp1) - (λX_op. - match plus_b8_dc_dc X_op (compl_b8 M_op) false with - [ pair R_op carry ⇒ - let X7 ≝ MSB_b8 X_op in let M7 ≝ MSB_b8 M_op in let R7 ≝ MSB_b8 R_op in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 R_op 〈x0,x0〉) in - (* C = nX7&M7 | M7&R7 | R7&nX7 *) - let s_tmp3 ≝ set_c_flag m t s_tmp2 (((⊖X7)⊗M7) ⊕ (M7⊗R7) ⊕ (R7⊗(⊖X7))) in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 R7 in - (* V = X7&nM7&nR7 | nX7&M7&R7 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 ((X7⊗(⊖M7)⊗(⊖R7)) ⊕ ((⊖X7)⊗M7⊗R7)) in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc) ] ) ]). - -(* decimal adjiust A *) -(* per i dettagli vedere daa_b8 (modulo byte8) *) -ndefinition execute_DAA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_h_flag m t s) - (λH. - let M_op ≝ get_acc_8_low_reg m t s in - match daa_b8 H (get_c_flag m t s) M_op with - [ pair R_op carry ⇒ - (* A = R *) - let s_tmp1 ≝ set_acc_8_low_reg m t s R_op in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 R_op 〈x0,x0〉) in - (* C = carry *) - let s_tmp3 ≝ set_c_flag m t s_tmp2 carry in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_b8 R_op) in - (* V = M7 ⊙ R7 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 ((MSB_b8 M_op) ⊙ (MSB_b8 R_op)) in - (* newpc = curpc *) - Some ? (pair … s_tmp5 cur_pc) ]). - -(* if (--M)≠0, branch *) -ndefinition execute_DBNZ ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - match M_op with - [ mk_word16 MH_op ML_op ⇒ - (* --M *) - let MH_op' ≝ pred_b8 MH_op in - opt_map … (multi_mode_write true m t s_tmp1 cur_pc i MH_op') - (λS_PC.match S_PC with - [ pair s_tmp2 _ ⇒ - (* if (--M)≠0, branch *) - match eq_b8 MH_op' 〈x0,x0〉 with - (* new_pc = new_pc *) - [ true ⇒ Some ? (pair … s_tmp2 new_pc) - (* new_pc = new_pc + rel *) - | false ⇒ Some ? (pair … s_tmp2 (branched_pc m t s_tmp2 new_pc ML_op)) ]])]]). - -(* M = M - 1 *) -ndefinition execute_DEC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_COM_DEC_INC_NEG_aux m t s i cur_pc pred_b8 - (* fV = M7&nR7 *) - (λM7.λR7.M7⊗(⊖R7)) - (* fC = C *) - (λC_op.λR_op.C_op). - -(* A = H:A/X, H = H:AmodX se non c'e' overflow, altrimenti invariati *) -(* per i dettagli vedere div_b8 (modulo word16) *) -ndefinition execute_DIV ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_8_high_reg m t s) - (λH_op.opt_map … (get_indX_8_low_reg m t s) - (λX_op.match div_b8 〈H_op:(get_acc_8_low_reg m t s)〉 X_op with - [ triple quoz rest overflow ⇒ - (* C = overflow *) - let s_tmp1 ≝ set_c_flag m t s overflow in - (* A = A o H:A/X *) - let s_tmp2 ≝ match overflow with - [ true ⇒ s_tmp1 - | false ⇒ set_acc_8_low_reg m t s_tmp1 quoz ] in - (* Z = nA7&nA6&nA5&nA4&nA3&nA2&nA1&nA0 *) - (* NB: che A sia cambiato o no, lo testa *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 (get_acc_8_low_reg m t s_tmp2) 〈x0,x0〉) in - (* H = H o H:AmodX *) - opt_map … (match overflow with - [ true ⇒ Some ? s_tmp3 - | false ⇒ set_indX_8_high_reg m t s_tmp3 rest]) - (λs_tmp4.Some ? (pair … s_tmp4 cur_pc)) ])). - -(* A = A ⊙ M *) -ndefinition execute_EOR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_AND_BIT_EOR_ORA_aux m t s i cur_pc true xor_b8. - -(* M = M + 1 *) -ndefinition execute_INC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_COM_DEC_INC_NEG_aux m t s i cur_pc succ_b8 - (* fV = nM7&R7 *) - (λM7.λR7.(⊖M7)⊗R7) - (* fC = C *) - (λC_op.λR_op.C_op). - -(* jmp, il nuovo indirizzo e' una WORD *) -ndefinition execute_JMP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC. - (* newpc = M_op *) - Some ? (pair … (fst3T ??? S_M_PC) (snd3T ??? S_M_PC))). - -(* jump to subroutine *) -(* HC05/HC08/HCS08 si appoggiano allo stack, RS08 a SPC *) -ndefinition execute_JSR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ let aux ≝ - (* push (new_pc low) *) - opt_map … (aux_push m t s_tmp1 (w16l new_pc)) - (* push (new_pc high) *) - (λs_tmp2.opt_map … (aux_push m t s_tmp2 (w16h new_pc)) - (* newpc = M_op *) - (λs_tmp3.Some ? (pair … s_tmp3 M_op))) - in match m with - [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux - | RS08 ⇒ - (* SPC = new_pc *) - opt_map … (set_spc_reg m t s_tmp1 new_pc) - (* newpc = M_op *) - (λs_tmp2.Some ? (pair … s_tmp2 M_op)) - ]]). - -(* A = M *) -ndefinition execute_LDA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - (* A = M *) - let s_tmp2 ≝ set_acc_8_low_reg m t s_tmp1 M_op in - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 M_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_b8 M_op) in - (* V = 0 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc) ]). - -(* H:X = M *) -ndefinition execute_LDHX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load false m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (set_indX_16_reg m t s_tmp1 M_op) - (λs_tmp2. - (* Z = nR15&nR14&nR13nR12&nR11&nR10&nR9&nR8nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_w16 M_op 〈〈x0,x0〉:〈x0,x0〉〉) in - (* N = R15 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_w16 M_op) in - (* V = 0 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc)) ]). - -(* X = M *) -ndefinition execute_LDX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - opt_map … (set_indX_8_low_reg m t s_tmp1 M_op) - (λs_tmp2. - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 M_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_b8 M_op) in - (* V = 0 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc)) ]). - -(* M = 0 -> rcr M -> C' *) -ndefinition execute_LSR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ASL_ASR_LSR_ROL_ROR_aux m t s i cur_pc (λM_op.λC_op.rcr_b8 M_op false). - -(* M2 = M1 *) -ndefinition execute_MOV ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* R_op = M1 *) - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_R_PC.match S_R_PC with - [ triple s_tmp1 R_op tmp_pc ⇒ - (* M2 = R_op *) - opt_map … (multi_mode_write true m t s_tmp1 tmp_pc i R_op) - (λS_PC.match S_PC with - [ pair s_tmp2 new_pc ⇒ - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp3 ≝ set_z_flag m t s_tmp2 (eq_b8 R_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp4 ≝ setweak_n_flag m t s_tmp3 (MSB_b8 R_op) in - (* V = 0 *) - let s_tmp5 ≝ setweak_v_flag m t s_tmp4 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp5 new_pc)])]). - -(* X:A = X * A *) -ndefinition execute_MUL ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_8_low_reg m t s) - (λX_op.let R_op ≝ mul_b8 X_op (get_acc_8_low_reg m t s) in - opt_map … (set_indX_8_low_reg m t s (w16h R_op)) - (λs_tmp.Some ? (pair … (set_acc_8_low_reg m t s_tmp (w16l R_op)) cur_pc))). - -(* M = compl M *) -ndefinition execute_NEG ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_COM_DEC_INC_NEG_aux m t s i cur_pc compl_b8 - (* fV = M7&R7 *) - (λM7.λR7.M7⊗R7) - (* fC = R7|R6|R5|R4|R3|R2|R1|R0 *) - (λC_op.λR_op.⊖(eq_b8 R_op 〈x0,x0〉)). - -(* nulla *) -ndefinition execute_NOP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … s cur_pc). - -(* A = (mk_byte8 (b8l A) (b8h A)) *) -(* cioe' swap del nibble alto/nibble basso di A *) -ndefinition execute_NSA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - match get_acc_8_low_reg m t s with [ mk_byte8 ah al ⇒ - (* A = (mk_byte8 (b8l A) (b8h A)) *) - Some ? (pair … (set_acc_8_low_reg m t s 〈al,ah〉) cur_pc) ]. - -(* A = A | M *) -ndefinition execute_ORA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_AND_BIT_EOR_ORA_aux m t s i cur_pc true or_b8. - -(* push A *) -ndefinition execute_PSHA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (aux_push m t s (get_acc_8_low_reg m t s)) - (λs_tmp1.Some ? (pair … s_tmp1 cur_pc)). - -(* push H *) -ndefinition execute_PSHH ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_8_high_reg m t s) - (λH_op.opt_map … (aux_push m t s H_op) - (λs_tmp1.Some ? (pair … s_tmp1 cur_pc))). - -(* push X *) -ndefinition execute_PSHX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_8_low_reg m t s) - (λH_op.opt_map … (aux_push m t s H_op) - (λs_tmp1.Some ? (pair … s_tmp1 cur_pc))). - -(* pop A *) -ndefinition execute_PULA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (aux_pop m t s) - (λS_and_A.match S_and_A with [ pair s_tmp1 A_op ⇒ - Some ? (pair … (set_acc_8_low_reg m t s_tmp1 A_op) cur_pc) ]). - -(* pop H *) -ndefinition execute_PULH ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (aux_pop m t s) - (λS_and_H.match S_and_H with [ pair s_tmp1 H_op ⇒ - opt_map … (set_indX_8_high_reg m t s_tmp1 H_op) - (λs_tmp2.Some ? (pair … s_tmp2 cur_pc))]). - -(* pop X *) -ndefinition execute_PULX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (aux_pop m t s) - (λS_and_X.match S_and_X with [ pair s_tmp1 X_op ⇒ - opt_map … (set_indX_8_low_reg m t s_tmp1 X_op) - (λs_tmp2.Some ? (pair … s_tmp2 cur_pc))]). - -(* M = C' <- rcl M <- C *) -ndefinition execute_ROL ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ASL_ASR_LSR_ROL_ROR_aux m t s i cur_pc (λM_op.λC_op.rcl_b8 M_op C_op). - -(* M = C -> rcr M -> C' *) -ndefinition execute_ROR ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_ASL_ASR_LSR_ROL_ROR_aux m t s i cur_pc (λM_op.λC_op.rcr_b8 M_op C_op). - -(* SP = 0xuuFF *) -(* lascia inalterato il byte superiore di SP *) -ndefinition execute_RSP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_sp_reg m t s) - (λSP_op.match SP_op with [ mk_word16 sph spl ⇒ - opt_map … (set_sp_reg m t s 〈sph:〈xF,xF〉〉) - (λs_tmp.Some ? (pair … s_tmp cur_pc))]). - -(* return from interrupt *) -ndefinition execute_RTI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* pop (CCR) *) - opt_map … (aux_pop m t s) - (λS_and_CCR.match S_and_CCR with [ pair s_tmp1 CCR_op ⇒ - let s_tmp2 ≝ aux_set_CCR m t s_tmp1 CCR_op in - (* pop (A) *) - opt_map … (aux_pop m t s_tmp2) - (λS_and_A.match S_and_A with [ pair s_tmp3 A_op ⇒ - let s_tmp4 ≝ set_acc_8_low_reg m t s_tmp3 A_op in - (* pop (X) *) - opt_map … (aux_pop m t s_tmp4) - (λS_and_X.match S_and_X with [ pair s_tmp5 X_op ⇒ - opt_map … (set_indX_8_low_reg m t s_tmp5 X_op) - (* pop (PC high) *) - (λs_tmp6.opt_map … (aux_pop m t s_tmp6) - (λS_and_PCH.match S_and_PCH with [ pair s_tmp7 PCH_op ⇒ - (* pop (PC low) *) - opt_map … (aux_pop m t s_tmp7) - (λS_and_PCL.match S_and_PCL with [ pair s_tmp8 PCL_op ⇒ - Some ? (pair … s_tmp8 〈PCH_op:PCL_op〉)])]))])])]). - -(* return from subroutine *) -(* HC05/HC08/HCS08 si appoggia allo stack, RS08 si appoggia a SPC *) -ndefinition execute_RTS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - let aux ≝ - (* pop (PC high) *) - opt_map … (aux_pop m t s) - (λS_and_PCH.match S_and_PCH with [ pair s_tmp1 PCH_op ⇒ - (* pop (PC low) *) - opt_map … (aux_pop m t s_tmp1) - (λS_and_PCL.match S_and_PCL with [ pair s_tmp2 PCL_op ⇒ - Some ? (pair … s_tmp2 〈PCH_op:PCL_op〉)])]) - in match m with - [ HC05 ⇒ aux | HC08 ⇒ aux | HCS08 ⇒ aux - | RS08 ⇒ - (* new_pc = SPC *) - opt_map … (get_spc_reg m t s) - (λSPC_op.Some ? (pair … s SPC_op)) - ]. - -(* A = A - M - C *) -ndefinition execute_SBC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_SBC_SUB_aux m t s i cur_pc true - (λA_op.λM_op.λC_op.match plus_b8_dc_dc A_op (compl_b8 M_op) false with - [ pair resb resc ⇒ match C_op with - [ true ⇒ plus_b8_dc_dc resb 〈xF,xF〉 false - | false ⇒ pair … resb resc ]]). - -(* C = 1 *) -ndefinition execute_SEC ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (set_c_flag m t s true) cur_pc). - -(* I = 1 *) -ndefinition execute_SEI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (set_i_flag m t s true) - (λs_tmp.Some ? (pair … s_tmp cur_pc)). - -(* swap SPCh,A *) -(* senso: nell'RS08 SPC non e' accessibile direttamente e come si possono - fare subroutine annidate se RA (return address) e' salvato sempre in SPC? - occore accedere a SPC e salvarne il contenuto *) -ndefinition execute_SHA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_spc_reg m t s) - (λSPC_op.opt_map … (set_spc_reg m t s 〈(get_acc_8_low_reg m t s):(w16l SPC_op)〉) - (λs_tmp1.Some ? (pair … (set_acc_8_low_reg m t s_tmp1 (w16h SPC_op)) cur_pc))). - -(* swap SPCl,A *) -(* senso: nell'RS08 SPC non e' accessibile direttamente e come si possono - fare subroutine annidate se RA (return address) e' salvato sempre in SPC? - occore accedere a SPC e salvarne il contenuto *) -ndefinition execute_SLA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_spc_reg m t s) - (λSPC_op.opt_map … (set_spc_reg m t s 〈(w16h SPC_op):(get_acc_8_low_reg m t s)〉) - (λs_tmp1.Some ? (pair … (set_acc_8_low_reg m t s_tmp1 (w16l SPC_op)) cur_pc))). - -(* M = A *) -ndefinition execute_STA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* M = A *) - let A_op ≝ (get_acc_8_low_reg m t s) in - opt_map … (multi_mode_write true m t s cur_pc i A_op) - (λS_op_and_PC.match S_op_and_PC with - [ pair s_tmp1 new_pc ⇒ - (* Z = nA7&nA6&nA5&nA4&nA3&nA2&nA1&nA0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 A_op 〈x0,x0〉) in - (* N = A7 *) - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 (MSB_b8 A_op) in - (* V = 0 *) - let s_tmp4 ≝ setweak_v_flag m t s_tmp3 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp4 new_pc) ]). - -(* M = H:X *) -ndefinition execute_STHX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* M = H:X *) - opt_map … (get_indX_16_reg m t s) - (λX_op.opt_map … (multi_mode_write false m t s cur_pc i X_op) - (λS_op_and_PC.match S_op_and_PC with - [ pair s_tmp1 new_pc ⇒ - (* Z = nR15&nR14&nR13nR12&nR11&nR10&nR9&nR8nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_w16 X_op 〈〈x0,x0〉:〈x0,x0〉〉) in - (* N = R15 *) - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 (MSB_w16 X_op) in - (* V = 0 *) - let s_tmp4 ≝ setweak_v_flag m t s_tmp3 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp4 new_pc) ])). - -(* I = 0 *) -ndefinition execute_STOP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (setweak_i_flag m t s false) cur_pc). - -(* M = X *) -ndefinition execute_STX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* M = X *) - opt_map … (get_indX_8_low_reg m t s) - (λX_op.opt_map … (multi_mode_write true m t s cur_pc i X_op) - (λS_op_and_PC.match S_op_and_PC with - [ pair s_tmp1 new_pc ⇒ - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 X_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 (MSB_b8 X_op) in - (* V = 0 *) - let s_tmp4 ≝ setweak_v_flag m t s_tmp3 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp4 new_pc) ])). - -(* A = A - M *) -ndefinition execute_SUB ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - execute_SBC_SUB_aux m t s i cur_pc true (λA_op.λM_op.λC_op.plus_b8_dc_dc A_op (compl_b8 M_op) false). - -(* software interrupt *) -ndefinition execute_SWI ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - (* indirizzo da cui caricare il nuovo pc *) - let vector ≝ get_pc_reg m t (set_pc_reg m t s 〈〈xF,xF〉:〈xF,xC〉〉) in - (* push (cur_pc low) *) - opt_map … (aux_push m t s (w16l cur_pc)) - (* push (cur_pc high *) - (λs_tmp1.opt_map … (aux_push m t s_tmp1 (w16h cur_pc)) - (λs_tmp2.opt_map … (get_indX_8_low_reg m t s_tmp2) - (* push (X) *) - (λX_op.opt_map … (aux_push m t s_tmp2 X_op) - (* push (A) *) - (λs_tmp3.opt_map … (aux_push m t s_tmp3 (get_acc_8_low_reg m t s_tmp3)) - (* push (CCR) *) - (λs_tmp4.opt_map … (aux_push m t s_tmp4 (aux_get_CCR m t s_tmp4)) - (* I = 1 *) - (λs_tmp5.opt_map … (set_i_flag m t s_tmp5 true) - (* load from vector high *) - (λs_tmp6.opt_map … (memory_filter_read m t s_tmp6 vector) - (* load from vector low *) - (λaddrh.opt_map … (memory_filter_read m t s_tmp6 (succ_w16 vector)) - (* newpc = [vector] *) - (λaddrl.Some ? (pair … s_tmp6 〈addrh:addrl〉)))))))))). - -(* flags = A *) -ndefinition execute_TAP ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (aux_set_CCR m t s (get_acc_8_low_reg m t s)) cur_pc). - -(* X = A *) -ndefinition execute_TAX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (set_indX_8_low_reg m t s (get_acc_8_low_reg m t s)) - (λs_tmp.Some ? (pair … s_tmp cur_pc)). - -(* A = flags *) -ndefinition execute_TPA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (set_acc_8_low_reg m t s (aux_get_CCR m t s)) cur_pc). - -(* flags = M - 0 *) -(* implementata senza richiamare la sottrazione, la modifica dei flag - e' immediata *) -ndefinition execute_TST ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (multi_mode_load true m t s cur_pc i) - (λS_M_PC.match S_M_PC with - [ triple s_tmp1 M_op new_pc ⇒ - (* Z = nR7&nR6&nR5&nR4&nR3&nR2&nR1&nR0 *) - let s_tmp2 ≝ set_z_flag m t s_tmp1 (eq_b8 M_op 〈x0,x0〉) in - (* N = R7 *) - let s_tmp3 ≝ setweak_n_flag m t s_tmp2 (MSB_b8 M_op) in - (* V = 0 *) - let s_tmp4 ≝ setweak_v_flag m t s_tmp3 false in - (* newpc = nextpc *) - Some ? (pair … s_tmp4 new_pc) ]). - -(* H:X = SP + 1 *) -ndefinition execute_TSX ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_sp_reg m t s ) - (λSP_op.opt_map … (set_indX_16_reg m t s (succ_w16 SP_op)) - (* H:X = SP + 1 *) - (λs_tmp.Some ? (pair … s_tmp cur_pc))). - -(* A = X *) -ndefinition execute_TXA ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_8_low_reg m t s) - (λX_op.Some ? (pair … (set_acc_8_low_reg m t s X_op) cur_pc)). - -(* SP = H:X - 1 *) -ndefinition execute_TXS ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - opt_map … (get_indX_16_reg m t s ) - (λX_op.opt_map … (set_sp_reg m t s (pred_w16 X_op)) - (* SP = H:X - 1 *) - (λs_tmp.Some ? (pair … s_tmp cur_pc))). - -(* I = 0 *) -ndefinition execute_WAIT ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λi:instr_mode.λcur_pc:word16. - Some ? (pair … (setweak_i_flag m t s false) cur_pc). - -(* **** *) -(* TICK *) -(* **** *) - -(* enumerazione delle possibili modalita' di sospensione *) -ninductive susp_type : Type ≝ - BGND_MODE: susp_type -| STOP_MODE: susp_type -| WAIT_MODE: susp_type. - -(* un tipo opzione ad hoc - - errore: errore+stato (seguira' reset o …, cmq lo stato non va buttato) - - sospensione: sospensione+stato (seguira' resume o …) - - ok: stato -*) -ninductive tick_result (A:Type) : Type ≝ - TickERR : A → error_type → tick_result A -| TickSUSP : A → susp_type → tick_result A -| TickOK : A → tick_result A. - -(* sostanazialmente simula - - fetch/decode/execute - - l'esecuzione e' considerata atomica quindi nel caso di un'instruzione - da 3 cicli la successione sara' - ([fetch/decode] s,clk:None) → - ( s,clk:Some 1,pseudo,mode,3,cur_pc) → - ( s,clk:Some 2,pseudo,mode,3,cur_pc) → - ([execute] s',clk:None) *) - -ndefinition tick_execute ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. -λpseudo:any_opcode m.λmode:instr_mode.λcur_pc:word16. - let abs_pseudo ≝ match pseudo with [ anyOP pseudo' ⇒ pseudo' ] in - let a_status_and_fetch ≝ match abs_pseudo with - [ ADC ⇒ execute_ADC m t s mode cur_pc (* add with carry *) - | ADD ⇒ execute_ADD m t s mode cur_pc (* add *) - | AIS ⇒ execute_AIS m t s mode cur_pc (* add immediate to SP *) - | AIX ⇒ execute_AIX m t s mode cur_pc (* add immediate to X *) - | AND ⇒ execute_AND m t s mode cur_pc (* and *) - | ASL ⇒ execute_ASL m t s mode cur_pc (* aritmetic shift left *) - | ASR ⇒ execute_ASR m t s mode cur_pc (* aritmetic shift right *) - | BCC ⇒ execute_BCC m t s mode cur_pc (* branch if C=0 *) - | BCLRn ⇒ execute_BCLRn m t s mode cur_pc (* clear bit n *) - | BCS ⇒ execute_BCS m t s mode cur_pc (* branch if C=1 *) - | BEQ ⇒ execute_BEQ m t s mode cur_pc (* branch if Z=1 *) - | BGE ⇒ execute_BGE m t s mode cur_pc (* branch if N⊙V=0 (great or equal) *) - | BGND ⇒ execute_BGND m t s mode cur_pc (* !!background mode!!*) - | BGT ⇒ execute_BGT m t s mode cur_pc (* branch if Z|N⊙V=0 clear (great) *) - | BHCC ⇒ execute_BHCC m t s mode cur_pc (* branch if H=0 *) - | BHCS ⇒ execute_BHCS m t s mode cur_pc (* branch if H=1 *) - | BHI ⇒ execute_BHI m t s mode cur_pc (* branch if C|Z=0, (higher) *) - | BIH ⇒ execute_BIH m t s mode cur_pc (* branch if nIRQ=1 *) - | BIL ⇒ execute_BIL m t s mode cur_pc (* branch if nIRQ=0 *) - | BIT ⇒ execute_BIT m t s mode cur_pc (* flag = and (bit test) *) - | BLE ⇒ execute_BLE m t s mode cur_pc (* branch if Z|N⊙V=1 (less or equal) *) - | BLS ⇒ execute_BLS m t s mode cur_pc (* branch if C|Z=1 (lower or same) *) - | BLT ⇒ execute_BLT m t s mode cur_pc (* branch if N⊙1=1 (less) *) - | BMC ⇒ execute_BMC m t s mode cur_pc (* branch if I=0 (interrupt mask clear) *) - | BMI ⇒ execute_BMI m t s mode cur_pc (* branch if N=1 (minus) *) - | BMS ⇒ execute_BMS m t s mode cur_pc (* branch if I=1 (interrupt mask set) *) - | BNE ⇒ execute_BNE m t s mode cur_pc (* branch if Z=0 *) - | BPL ⇒ execute_BPL m t s mode cur_pc (* branch if N=0 (plus) *) - | BRA ⇒ execute_BRA m t s mode cur_pc (* branch always *) - | BRCLRn ⇒ execute_BRCLRn m t s mode cur_pc (* branch if bit n clear *) - | BRN ⇒ execute_BRN m t s mode cur_pc (* branch never (nop) *) - | BRSETn ⇒ execute_BRSETn m t s mode cur_pc (* branch if bit n set *) - | BSETn ⇒ execute_BSETn m t s mode cur_pc (* set bit n *) - | BSR ⇒ execute_BSR m t s mode cur_pc (* branch to subroutine *) - | CBEQA ⇒ execute_CBEQA m t s mode cur_pc (* compare (A) and BEQ *) - | CBEQX ⇒ execute_CBEQX m t s mode cur_pc (* compare (X) and BEQ *) - | CLC ⇒ execute_CLC m t s mode cur_pc (* C=0 *) - | CLI ⇒ execute_CLI m t s mode cur_pc (* I=0 *) - | CLR ⇒ execute_CLR m t s mode cur_pc (* operand=0 *) - | CMP ⇒ execute_CMP m t s mode cur_pc (* flag = sub (compare A) *) - | COM ⇒ execute_COM m t s mode cur_pc (* not (1 complement) *) - | CPHX ⇒ execute_CPHX m t s mode cur_pc (* flag = sub (compare H:X) *) - | CPX ⇒ execute_CPX m t s mode cur_pc (* flag = sub (compare X) *) - | DAA ⇒ execute_DAA m t s mode cur_pc (* decimal adjust A *) - | DBNZ ⇒ execute_DBNZ m t s mode cur_pc (* dec and BNE *) - | DEC ⇒ execute_DEC m t s mode cur_pc (* operand=operand-1 (decrement) *) - | DIV ⇒ execute_DIV m t s mode cur_pc (* div *) - | EOR ⇒ execute_EOR m t s mode cur_pc (* xor *) - | INC ⇒ execute_INC m t s mode cur_pc (* operand=operand+1 (increment) *) - | JMP ⇒ execute_JMP m t s mode cur_pc (* jmp word [operand] *) - | JSR ⇒ execute_JSR m t s mode cur_pc (* jmp to subroutine *) - | LDA ⇒ execute_LDA m t s mode cur_pc (* load in A *) - | LDHX ⇒ execute_LDHX m t s mode cur_pc (* load in H:X *) - | LDX ⇒ execute_LDX m t s mode cur_pc (* load in X *) - | LSR ⇒ execute_LSR m t s mode cur_pc (* logical shift right *) - | MOV ⇒ execute_MOV m t s mode cur_pc (* move *) - | MUL ⇒ execute_MUL m t s mode cur_pc (* mul *) - | NEG ⇒ execute_NEG m t s mode cur_pc (* neg (2 complement) *) - | NOP ⇒ execute_NOP m t s mode cur_pc (* nop *) - | NSA ⇒ execute_NSA m t s mode cur_pc (* nibble swap A (al:ah <- ah:al) *) - | ORA ⇒ execute_ORA m t s mode cur_pc (* or *) - | PSHA ⇒ execute_PSHA m t s mode cur_pc (* push A *) - | PSHH ⇒ execute_PSHH m t s mode cur_pc (* push H *) - | PSHX ⇒ execute_PSHX m t s mode cur_pc (* push X *) - | PULA ⇒ execute_PULA m t s mode cur_pc (* pop A *) - | PULH ⇒ execute_PULH m t s mode cur_pc (* pop H *) - | PULX ⇒ execute_PULX m t s mode cur_pc (* pop X *) - | ROL ⇒ execute_ROL m t s mode cur_pc (* rotate left *) - | ROR ⇒ execute_ROR m t s mode cur_pc (* rotate right *) - | RSP ⇒ execute_RSP m t s mode cur_pc (* reset SP (0x00FF) *) - | RTI ⇒ execute_RTI m t s mode cur_pc (* return from interrupt *) - | RTS ⇒ execute_RTS m t s mode cur_pc (* return from subroutine *) - | SBC ⇒ execute_SBC m t s mode cur_pc (* sub with carry*) - | SEC ⇒ execute_SEC m t s mode cur_pc (* C=1 *) - | SEI ⇒ execute_SEI m t s mode cur_pc (* I=1 *) - | SHA ⇒ execute_SHA m t s mode cur_pc (* swap spc_high,A *) - | SLA ⇒ execute_SLA m t s mode cur_pc (* swap spc_low,A *) - | STA ⇒ execute_STA m t s mode cur_pc (* store from A *) - | STHX ⇒ execute_STHX m t s mode cur_pc (* store from H:X *) - | STOP ⇒ execute_STOP m t s mode cur_pc (* !!stop mode!! *) - | STX ⇒ execute_STX m t s mode cur_pc (* store from X *) - | SUB ⇒ execute_SUB m t s mode cur_pc (* sub *) - | SWI ⇒ execute_SWI m t s mode cur_pc (* software interrupt *) - | TAP ⇒ execute_TAP m t s mode cur_pc (* flag=A (transfer A to process status byte *) - | TAX ⇒ execute_TAX m t s mode cur_pc (* X=A (transfer A to X) *) - | TPA ⇒ execute_TPA m t s mode cur_pc (* A=flag (transfer process status byte to A) *) - | TST ⇒ execute_TST m t s mode cur_pc (* flag = sub (test) *) - | TSX ⇒ execute_TSX m t s mode cur_pc (* X:H=SP (transfer SP to H:X) *) - | TXA ⇒ execute_TXA m t s mode cur_pc (* A=X (transfer X to A) *) - | TXS ⇒ execute_TXS m t s mode cur_pc (* SP=X:H (transfer H:X to SP) *) - | WAIT ⇒ execute_WAIT m t s mode cur_pc (* !!wait mode!!*) - ] in match a_status_and_fetch with -(* errore nell'execute (=caricamento argomenti)? riportato in output *) -(* nessun avanzamento e clk a None *) - [ None ⇒ TickERR ? (set_clk_desc m t s (None ?)) ILL_EX_AD - | Some status_and_newpc ⇒ -(* aggiornamento centralizzato di pc e clk *) - match status_and_newpc with - [ pair s_tmp1 new_pc ⇒ - let s_tmp2 ≝ set_pc_reg m t s_tmp1 new_pc in - let s_tmp3 ≝ set_clk_desc m t s_tmp2 (None ?) in -(* distinzione fra le 4 modalita' possibili, normale/BGND/STOP/WAIT *) - match eq_op abs_pseudo BGND with - [ true ⇒ TickSUSP ? s_tmp3 BGND_MODE - | false ⇒ match eq_op abs_pseudo STOP with - [ true ⇒ TickSUSP ? s_tmp3 STOP_MODE - | false ⇒ match eq_op abs_pseudo WAIT with - [ true ⇒ TickSUSP ? s_tmp3 WAIT_MODE - | false ⇒ TickOK ? s_tmp3 - ]]]]]. - -ndefinition tick ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - let opt_info ≝ clk_desc m t s in - match opt_info with - (* e' il momento del fetch *) - [ None ⇒ match fetch m t s with - (* errore nel fetch/decode? riportato in output, nessun avanzamento *) - [ FetchERR err ⇒ TickERR ? s err - (* nessun errore nel fetch *) - | FetchOK fetch_info cur_pc ⇒ match fetch_info with - [ quadruple pseudo mode _ tot_clk ⇒ - match eq_b8 〈x0,x1〉 tot_clk with - (* un solo clk, execute subito *) - [ true ⇒ tick_execute m t s pseudo mode cur_pc - (* piu' clk, execute rimandata *) - | false ⇒ TickOK ? (set_clk_desc m t s (Some ? (quintuple … 〈x0,x1〉 pseudo mode tot_clk cur_pc))) - ] - ] - ] - (* il fetch e' gia' stato eseguito, e' il turno di execute? *) - | Some info ⇒ match info with [ quintuple cur_clk pseudo mode tot_clk cur_pc ⇒ - match eq_b8 (succ_b8 cur_clk) tot_clk with - (* si *) - [ true ⇒ tick_execute m t s pseudo mode cur_pc - (* no, avanzamento cur_clk *) - | false ⇒ TickOK ? (set_clk_desc m t s (Some ? (quintuple … (succ_b8 cur_clk) pseudo mode tot_clk cur_pc))) - ] - ] - ]. - -(* ********** *) -(* ESECUZIONE *) -(* ********** *) - -nlet rec execute (m:mcu_type) (t:memory_impl) (s:tick_result (any_status m t)) (n:nat) on n ≝ - match s with - [ TickERR s' error ⇒ TickERR ? s' error - | TickSUSP s' susp ⇒ TickSUSP ? s' susp - | TickOK s' ⇒ match n with [ O ⇒ TickOK ? s' | S n' ⇒ execute m t (tick m t s') n' ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/multivm_lemmas.ma b/helm/software/matita/contribs/ng_assembly/freescale/multivm_lemmas.ma deleted file mode 100755 index d0d74750d..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/multivm_lemmas.ma +++ /dev/null @@ -1,57 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/multivm.ma". -include "common/nat_lemmas.ma". - -nlemma breakpoint_err : ∀m,t,s,err,n.execute m t (TickERR ? s err) n = TickERR ? s err. - #m; #t; #s; #err; #n; - ncases n; - ##[ ##2: #n1; ##] - nnormalize; - napply refl_eq. -nqed. - -nlemma breakpoint_susp : ∀m,t,s,susp,n.execute m t (TickSUSP ? s susp) n = TickSUSP ? s susp. - #m; #t; #s; #susp; #n; - ncases n; - ##[ ##2: #n1; ##] - nnormalize; - napply refl_eq. -nqed. - -nlemma breakpoint : - ∀m,t,n1,n2,s. execute m t s (n1 + n2) = execute m t (execute m t s n1) n2. - #m; #t; #n1; - nelim n1; - ##[ ##1: nnormalize; #n2; #s; ncases s; nnormalize; ##[ ##1,2: #x ##] #y; napply refl_eq - ##| ##2: #n3; #H; #n2; #s; ncases s; - ##[ ##1: #x; #y; nnormalize; nrewrite > (breakpoint_err m t x y n2); napply refl_eq - ##| ##2: #x; #y; nnormalize; nrewrite > (breakpoint_susp m t x y n2); napply refl_eq - ##| ##3: #x; nrewrite > (Sn_p_n_to_S_npn n3 n2); - nchange with ((execute m t (tick m t x) (n3+n2)) = - (execute m t (execute m t (tick m t x) n3) n2)); - nrewrite > (H n2 (tick m t x)); - napply refl_eq - ##] - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/status.ma b/helm/software/matita/contribs/ng_assembly/freescale/status.ma deleted file mode 100755 index 9eba21d29..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/status.ma +++ /dev/null @@ -1,1275 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "memory/memory_abs.ma". -include "freescale/opcode_base.ma". - -(* *********************************** *) -(* STATUS INTERNO DEL PROCESSORE (ALU) *) -(* *********************************** *) - -(* ALU dell'HC05 *) -nrecord alu_HC05: Type ≝ - { - (* A: registo accumulatore *) - acc_low_reg_HC05 : byte8; - (* X: registro indice *) - indX_low_reg_HC05 : byte8; - (* SP: registo stack pointer *) - sp_reg_HC05 : word16; - (* modificatori di SP: per esempio e' definito come 0000000011xxxxxxb *) - (* la logica della sua costruzione e' quindi (SP∧mask)∨fix *) - (* totalmente racchiusa nella ALU, bastera' fare get(set(SP)) *) - sp_mask_HC05 : word16; - sp_fix_HC05 : word16; - (* PC: registro program counter *) - pc_reg_HC05 : word16; - (* modificatore di PC: per esempio e' definito come 00xxxxxxxxxxxxxxb *) - (* la logica della sua costruzione e' quindi (PC∧mask) *) - (* totalmente racchiusa nella ALU, bastera' fare get(set(PC)) *) - pc_mask_HC05 : word16; - - (* H: flag semi-carry (somma nibble basso) *) - h_flag_HC05 : bool; - (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *) - i_flag_HC05 : bool; - (* N: flag segno/negativita' *) - n_flag_HC05 : bool; - (* Z: flag zero *) - z_flag_HC05 : bool; - (* C: flag carry *) - c_flag_HC05 : bool; - - (* IRQ: flag che simula il pin esterno IRQ *) - irq_flag_HC05 : bool - }. - -notation "{hvbox('A_Reg' ≝ acclow ; break 'X_Reg' ≝ indxlow ; break 'Sp_Reg' ≝ sp ; break 'Sp_Mask' ≝ spm ; break 'Sp_Fix' ≝ spf ; break 'Pc_Reg' ≝ pc ; break 'Pc_Mask' ≝ pcm ; break 'H_Flag' ≝ hfl ; break 'I_Flag' ≝ ifl ; break 'N_Flag' ≝ nfl ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl ; break 'IRQ_Flag' ≝ irqfl)}" - non associative with precedence 80 for - @{ 'mk_alu_HC05 $acclow $indxlow $sp $spm $spf $pc $pcm $hfl $ifl $nfl $zfl $cfl $irqfl }. -interpretation "mk_alu_HC05" 'mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl = - (mk_alu_HC05 acclow indxlow sp spm spf pc pcm hfl ifl nfl zfl cfl irqfl). - -(* ALU dell'HC08/HCS08 *) -nrecord alu_HC08: Type ≝ - { - (* A: registo accumulatore *) - acc_low_reg_HC08 : byte8; - (* X: registro indice parte bassa *) - indX_low_reg_HC08 : byte8; - (* H: registro indice parte alta *) - indX_high_reg_HC08 : byte8; - (* SP: registo stack pointer *) - sp_reg_HC08 : word16; - (* PC: registro program counter *) - pc_reg_HC08 : word16; - - (* V: flag overflow *) - v_flag_HC08 : bool; - (* H: flag semi-carry (somma nibble basso) *) - h_flag_HC08 : bool; - (* I: flag mascheramento degli interrupt mascherabili: 1=mascherati *) - i_flag_HC08 : bool; - (* N: flag segno/negativita' *) - n_flag_HC08 : bool; - (* Z: flag zero *) - z_flag_HC08 : bool; - (* C: flag carry *) - c_flag_HC08 : bool; - - (* IRQ: flag che simula il pin esterno IRQ *) - irq_flag_HC08 : bool - }. - -notation "{hvbox('A_Reg' ≝ acclow ; break 'X_Reg' ≝ indxlow ; break 'H_Reg' ≝ indxhigh ; break 'Sp_Reg' ≝ sp ; break 'Pc_Reg' ≝ pc ; break 'V_Flag' ≝ vfl ; break 'H_Flag' ≝ hfl ; break 'I_Flag' ≝ ifl ; break 'N_Flag' ≝ nfl ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl ; break 'IRQ_Flag' ≝ irqfl)}" - non associative with precedence 80 for - @{ 'mk_alu_HC08 $acclow $indxlow $indxhigh $sp $pc $vfl $hfl $ifl $nfl $zfl $cfl $irqfl }. -interpretation "mk_alu_HC08" 'mk_alu_HC08 acclow indxlow indxhigh sp pc vfl hfl ifl nfl zfl cfl irqfl = - (mk_alu_HC08 acclow indxlow indxhigh sp pc vfl hfl ifl nfl zfl cfl irqfl). - -(* ALU dell'RS08 *) -nrecord alu_RS08: Type ≝ - { - (* A: registo accumulatore *) - acc_low_reg_RS08 : byte8; - (* PC: registro program counter *) - pc_reg_RS08 : word16; - (* modificatore di PC: per esempio e' definito come 00xxxxxxxxxxxxxxb *) - (* la logica della sua costruzione e' quindi (PC∧mask) *) - (* totalmente racchiusa nella ALU, bastera' fare get(set(PC)) *) - pc_mask_RS08 : word16; - (* SPC: registro shadow program counter *) - (* NB: il suo modificatore e' lo stesso di PC *) - spc_reg_RS08 : word16; - - (* X: registro indice parte bassa *) - (* NB: in realta' e' mappato in memoria e non risiede nella ALU *) - (* la lettura/scrittura avviene tramite la locazione [0x000F] *) - (* la funzione memory_filter_read/write si occupera' di intercettare *) - (* e deviare sul registro le letture/scritture (modulo load_write) *) - x_map_RS08 : byte8; - (* PS: registro selezione di pagina *) - (* serve a indirizzare la finestra RAM di 64b [0x00C0-0x00FF] *) - (* su tutta la memoria installata [0x0000-0x3FFF]: [00pp pppp ppxx xxxx] *) - (* NB: in realta' e' mappato in memoria e non risiede nella ALU *) - (* la lettura/scrittura avviene tramite la locazione [0x001F] *) - (* la funzione memory_filter_read/write si occupera' di intercettare *) - (* e deviare sul registro le letture/scritture (modulo load_write) *) - ps_map_RS08 : byte8; - - (* Z: flag zero *) - z_flag_RS08 : bool; - (* C: flag carry *) - c_flag_RS08 : bool - }. - -notation "{hvbox('A_Reg' ≝ acclow ; break 'Pc_Reg' ≝ pc ; break 'Pc_Mask' ≝ pcm ; break 'Spc_Reg' ≝ spc ; break 'X_Map' ≝ xm ; break 'Ps_Map' ≝ psm ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl)}" - non associative with precedence 80 for - @{ 'mk_alu_RS08 $acclow $pc $pcm $spc $xm $psm $zfl $cfl }. -interpretation "mk_alu_RS08" 'mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl = - (mk_alu_RS08 acclow pc pcm spc xm psm zfl cfl). - -(* tipo processore dipendente dalla mcu, varia solo la ALU *) -nrecord any_status (mcu:mcu_type) (t:memory_impl): Type ≝ - { - alu : match mcu with - [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]; - - (* descritore della memoria *) - mem_desc : aux_mem_type t; - (* descrittore del tipo di memoria installata *) - chk_desc : aux_chk_type t; - (* descrittore del click = stato di avanzamento dell'esecuzione+cur_pc conseguente a fetch *) - (* 1) None = istruzione eseguita, attesa del fetch *) - (* 2) Some cur_clk,pseudo,mode,clks,cur_pc = fetch eseguito, countup a esecuzione *) - clk_desc : option (Prod5T byte8 (any_opcode mcu) (instr_mode) byte8 word16) - }. - -(* evitare di mostrare la memoria/descrittore che impalla il visualizzatore *) -notation > "{hvbox('Alu' ≝ alu ; break 'Clk' ≝ clk)}" non associative with precedence 80 - for @{ 'mk_any_status $alu $mem $chk $clk }. -interpretation "mk_any_status" 'mk_any_status alu mem chk clk = - (mk_any_status alu mem chk clk). - -(* **************** *) -(* GETTER SPECIFICI *) -(* **************** *) - -(* funzione ausiliaria per il tipaggio dei getter *) -ndefinition aux_get_typing ≝ λx:Type.λm:mcu_type.match m with - [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → x. - -(* REGISTRI *) - -(* getter di A, esiste sempre *) -ndefinition get_acc_8_low_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing byte8 with - [ HC05 ⇒ acc_low_reg_HC05 - | HC08 ⇒ acc_low_reg_HC08 - | HCS08 ⇒ acc_low_reg_HC08 - | RS08 ⇒ acc_low_reg_RS08 ] - (alu m t s). - -(* getter di X, non esiste sempre *) -ndefinition get_indX_8_low_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option byte8) with - [ HC05 ⇒ λalu.Some ? (indX_low_reg_HC05 alu) - | HC08 ⇒ λalu.Some ? (indX_low_reg_HC08 alu) - | HCS08 ⇒ λalu.Some ? (indX_low_reg_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di H, non esiste sempre *) -ndefinition get_indX_8_high_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option byte8) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.Some ? (indX_high_reg_HC08 alu) - | HCS08 ⇒ λalu.Some ? (indX_high_reg_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di H:X, non esiste sempre *) -ndefinition get_indX_16_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option word16) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.Some ? (mk_word16 (indX_high_reg_HC08 alu) (indX_low_reg_HC08 alu)) - | HCS08 ⇒ λalu.Some ? (mk_word16 (indX_high_reg_HC08 alu) (indX_low_reg_HC08 alu)) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di SP, non esiste sempre *) -ndefinition get_sp_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option word16) with - [ HC05 ⇒ λalu.Some ? (sp_reg_HC05 alu) - | HC08 ⇒ λalu.Some ? (sp_reg_HC08 alu) - | HCS08 ⇒ λalu.Some ? (sp_reg_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di PC, esiste sempre *) -ndefinition get_pc_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing word16 with - [ HC05 ⇒ pc_reg_HC05 - | HC08 ⇒ pc_reg_HC08 - | HCS08 ⇒ pc_reg_HC08 - | RS08 ⇒ pc_reg_RS08 ] - (alu m t s). - -(* getter di SPC, non esiste sempre *) -ndefinition get_spc_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option word16) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.None ? - | HCS08 ⇒ λalu.None ? - | RS08 ⇒ λalu.Some ? (spc_reg_RS08 alu) ] - (alu m t s). - -(* REGISTRI MEMORY MAPPED *) - -(* getter di memory mapped X, non esiste sempre *) -ndefinition get_x_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option byte8) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.None ? - | HCS08 ⇒ λalu.None ? - | RS08 ⇒ λalu.Some ? (x_map_RS08 alu) ] - (alu m t s). - -(* getter di memory mapped PS, non esiste sempre *) -ndefinition get_ps_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option byte8) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.None ? - | HCS08 ⇒ λalu.None ? - | RS08 ⇒ λalu.Some ? (ps_map_RS08 alu) ] - (alu m t s). - -(* FLAG *) - -(* getter di V, non esiste sempre *) -ndefinition get_v_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option bool) with - [ HC05 ⇒ λalu.None ? - | HC08 ⇒ λalu.Some ? (v_flag_HC08 alu) - | HCS08 ⇒ λalu.Some ? (v_flag_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di H, non esiste sempre *) -ndefinition get_h_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option bool) with - [ HC05 ⇒ λalu.Some ? (h_flag_HC05 alu) - | HC08 ⇒ λalu.Some ? (h_flag_HC08 alu) - | HCS08 ⇒ λalu.Some ? (h_flag_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di I, non esiste sempre *) -ndefinition get_i_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option bool) with - [ HC05 ⇒ λalu.Some ? (i_flag_HC05 alu) - | HC08 ⇒ λalu.Some ? (i_flag_HC08 alu) - | HCS08 ⇒ λalu.Some ? (i_flag_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di N, non esiste sempre *) -ndefinition get_n_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option bool) with - [ HC05 ⇒ λalu.Some ? (n_flag_HC05 alu) - | HC08 ⇒ λalu.Some ? (n_flag_HC08 alu) - | HCS08 ⇒ λalu.Some ? (n_flag_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* getter di Z, esiste sempre *) -ndefinition get_z_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing bool with - [ HC05 ⇒ z_flag_HC05 - | HC08 ⇒ z_flag_HC08 - | HCS08 ⇒ z_flag_HC08 - | RS08 ⇒ z_flag_RS08 ] - (alu m t s). - -(* getter di C, esiste sempre *) -ndefinition get_c_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing bool with - [ HC05 ⇒ c_flag_HC05 - | HC08 ⇒ c_flag_HC08 - | HCS08 ⇒ c_flag_HC08 - | RS08 ⇒ c_flag_RS08 ] - (alu m t s). - -(* getter di IRQ, non esiste sempre *) -ndefinition get_irq_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. - match m - return aux_get_typing (option bool) with - [ HC05 ⇒ λalu.Some ? (irq_flag_HC05 alu) - | HC08 ⇒ λalu.Some ? (irq_flag_HC08 alu) - | HCS08 ⇒ λalu.Some ? (irq_flag_HC08 alu) - | RS08 ⇒ λalu.None ? ] - (alu m t s). - -(* ***************************** *) -(* SETTER SPECIFICI FORTI/DEBOLI *) -(* ***************************** *) - -(* funzione ausiliaria per il tipaggio dei setter forti *) -ndefinition aux_set_typing ≝ λx:Type.λm:mcu_type. - match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] - → x → - match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]. - -(* funzione ausiliaria per il tipaggio dei setter deboli *) -ndefinition aux_set_typing_opt ≝ λx:Type.λm:mcu_type.option - (match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] - → x → - match m with [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ]). - -(* DESCRITTORI ESTERNI ALLA ALU *) - -(* setter forte della ALU *) -ndefinition set_alu ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λalu'. - mk_any_status m t alu' (mem_desc m t s) (chk_desc m t s) (clk_desc m t s). - -(* setter forte della memoria *) -ndefinition set_mem_desc ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λmem':aux_mem_type t. - mk_any_status m t (alu m t s) mem' (chk_desc m t s) (clk_desc m t s). - -(* setter forte del descrittore *) -ndefinition set_chk_desc ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λchk':aux_chk_type t. - mk_any_status m t (alu m t s) (mem_desc m t s) chk' (clk_desc m t s). - -(* setter forte del clik *) -ndefinition set_clk_desc ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t. -λclk':option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16). - mk_any_status m t (alu m t s) (mem_desc m t s) (chk_desc m t s) clk'. - -(* REGISTRO A *) - -(* setter specifico HC05 di A *) -ndefinition set_acc_8_low_reg_HC05 ≝ -λalu.λacclow':byte8. - mk_alu_HC05 - acclow' - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di A *) -ndefinition set_acc_8_low_reg_HC08 ≝ -λalu.λacclow':byte8. - mk_alu_HC08 - acclow' - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter specifico RS08 di A *) -ndefinition set_acc_8_low_reg_RS08 ≝ -λalu.λacclow':byte8. - mk_alu_RS08 - acclow' - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - (x_map_RS08 alu) - (ps_map_RS08 alu) - (z_flag_RS08 alu) - (c_flag_RS08 alu). - -(* setter forte di A *) -ndefinition set_acc_8_low_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λacclow':byte8. - set_alu m t s - (match m return aux_set_typing byte8 with - [ HC05 ⇒ set_acc_8_low_reg_HC05 - | HC08 ⇒ set_acc_8_low_reg_HC08 - | HCS08 ⇒ set_acc_8_low_reg_HC08 - | RS08 ⇒ set_acc_8_low_reg_RS08 - ] (alu m t s) acclow'). - -(* REGISTRO X *) - -(* setter specifico HC05 di X *) -ndefinition set_indX_8_low_reg_HC05 ≝ -λalu.λindxlow':byte8. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - indxlow' - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di X *) -ndefinition set_indX_8_low_reg_HC08 ≝ -λalu.λindxlow':byte8. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - indxlow' - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di X *) -ndefinition set_indX_8_low_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxlow':byte8. - opt_map … (match m return aux_set_typing_opt byte8 with - [ HC05 ⇒ Some ? set_indX_8_low_reg_HC05 - | HC08 ⇒ Some ? set_indX_8_low_reg_HC08 - | HCS08 ⇒ Some ? set_indX_8_low_reg_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) indxlow'))). - -(* setter debole di X *) -ndefinition setweak_indX_8_low_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxlow':byte8. - match set_indX_8_low_reg m t s indxlow' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO H *) - -(* setter specifico HC08/HCS08 di H *) -ndefinition set_indX_8_high_reg_HC08 ≝ -λalu.λindxhigh':byte8. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - indxhigh' - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di H *) -ndefinition set_indX_8_high_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxhigh':byte8. - opt_map … (match m return aux_set_typing_opt byte8 with - [ HC05 ⇒ None ? - | HC08 ⇒ Some ? set_indX_8_high_reg_HC08 - | HCS08 ⇒ Some ? set_indX_8_high_reg_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) indxhigh'))). - -(* setter debole di H *) -ndefinition setweak_indX_8_high_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindxhigh':byte8. - match set_indX_8_high_reg m t s indxhigh' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO H:X *) - -(* setter specifico HC08/HCS08 di H:X *) -ndefinition set_indX_16_reg_HC08 ≝ -λalu.λindx16:word16. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (w16l indx16) - (w16h indx16) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di H:X *) -ndefinition set_indX_16_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindx16:word16. - opt_map … (match m return aux_set_typing_opt word16 with - [ HC05 ⇒ None ? - | HC08 ⇒ Some ? set_indX_16_reg_HC08 - | HCS08 ⇒ Some ? set_indX_16_reg_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) indx16))). - -(* setter debole di H:X *) -ndefinition setweak_indX_16_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λindx16:word16. - match set_indX_16_reg m t s indx16 with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO SP *) - -(* setter specifico HC05 di SP, effettua (SP∧mask)∨fix *) -ndefinition set_sp_reg_HC05 ≝ -λalu.λsp':word16. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (or_w16 (and_w16 sp' (sp_mask_HC05 alu)) (sp_fix_HC05 alu)) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di SP *) -ndefinition set_sp_reg_HC08 ≝ -λalu.λsp':word16. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - sp' - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di SP *) -ndefinition set_sp_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λsp':word16. - opt_map … (match m return aux_set_typing_opt word16 with - [ HC05 ⇒ Some ? set_sp_reg_HC05 - | HC08 ⇒ Some ? set_sp_reg_HC08 - | HCS08 ⇒ Some ? set_sp_reg_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) sp'))). - -(* setter debole di SP *) -ndefinition setweak_sp_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λsp':word16. - match set_sp_reg m t s sp' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO PC *) - -(* setter specifico HC05 di PC, effettua PC∧mask *) -ndefinition set_pc_reg_HC05 ≝ -λalu.λpc':word16. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (and_w16 pc' (pc_mask_HC05 alu)) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di PC *) -ndefinition set_pc_reg_HC08 ≝ -λalu.λpc':word16. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - pc' - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter specifico RS08 di PC, effettua PC∧mask *) -ndefinition set_pc_reg_RS08 ≝ -λalu.λpc':word16. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (and_w16 pc' (pc_mask_RS08 alu)) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - (x_map_RS08 alu) - (ps_map_RS08 alu) - (z_flag_RS08 alu) - (c_flag_RS08 alu). - -(* setter forte di PC *) -ndefinition set_pc_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λpc':word16. - set_alu m t s - (match m return aux_set_typing word16 with - [ HC05 ⇒ set_pc_reg_HC05 - | HC08 ⇒ set_pc_reg_HC08 - | HCS08 ⇒ set_pc_reg_HC08 - | RS08 ⇒ set_pc_reg_RS08 - ] (alu m t s) pc'). - -(* REGISTRO SPC *) - -(* setter specifico RS08 di SPC, effettua SPC∧mask *) -ndefinition set_spc_reg_RS08 ≝ -λalu.λspc':word16. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (and_w16 spc' (pc_mask_RS08 alu)) - (x_map_RS08 alu) - (ps_map_RS08 alu) - (z_flag_RS08 alu) - (c_flag_RS08 alu). - -(* setter forte di SPC *) -ndefinition set_spc_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λspc':word16. - opt_map … (match m return aux_set_typing_opt word16 with - [ HC05 ⇒ None ? - | HC08 ⇒ None ? - | HCS08 ⇒ None ? - | RS08 ⇒ Some ? set_spc_reg_RS08 ]) - (λf.Some ? (set_alu m t s (f (alu m t s) spc'))). - -(* setter debole di SPC *) -ndefinition setweak_spc_reg ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λspc':word16. - match set_spc_reg m t s spc' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO MEMORY MAPPED X *) - -(* setter specifico RS08 di memory mapped X *) -ndefinition set_x_map_RS08 ≝ -λalu.λxm':byte8. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - xm' - (ps_map_RS08 alu) - (z_flag_RS08 alu) - (c_flag_RS08 alu). - -(* setter forte di memory mapped X *) -ndefinition set_x_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λxm':byte8. - opt_map … (match m return aux_set_typing_opt byte8 with - [ HC05 ⇒ None ? - | HC08 ⇒ None ? - | HCS08 ⇒ None ? - | RS08 ⇒ Some ? set_x_map_RS08 ]) - (λf.Some ? (set_alu m t s (f (alu m t s) xm'))). - -(* setter debole di memory mapped X *) -ndefinition setweak_x_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λxm':byte8. - match set_x_map m t s xm' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* REGISTRO MEMORY MAPPED PS *) - -(* setter specifico RS08 di memory mapped PS *) -ndefinition set_ps_map_RS08 ≝ -λalu.λpsm':byte8. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - (x_map_RS08 alu) - psm' - (z_flag_RS08 alu) - (c_flag_RS08 alu). - -(* setter forte di memory mapped PS *) -ndefinition set_ps_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λpsm':byte8. - opt_map … (match m return aux_set_typing_opt byte8 with - [ HC05 ⇒ None ? - | HC08 ⇒ None ? - | HCS08 ⇒ None ? - | RS08 ⇒ Some ? set_ps_map_RS08 ]) - (λf.Some ? (set_alu m t s (f (alu m t s) psm'))). - -(* setter debole di memory mapped PS *) -ndefinition setweak_ps_map ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λpsm':byte8. - match set_ps_map m t s psm' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* FLAG V *) - -(* setter specifico HC08/HCS08 di V *) -ndefinition set_v_flag_HC08 ≝ -λalu.λvfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - vfl' - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di V *) -ndefinition set_v_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λvfl':bool. - opt_map … (match m return aux_set_typing_opt bool with - [ HC05 ⇒ None ? - | HC08 ⇒ Some ? set_v_flag_HC08 - | HCS08 ⇒ Some ? set_v_flag_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) vfl'))). - -(* setter debole di V *) -ndefinition setweak_v_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λvfl':bool. - match set_v_flag m t s vfl' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* FLAG H *) - -(* setter specifico HC05 di H *) -ndefinition set_h_flag_HC05 ≝ -λalu.λhfl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - hfl' - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di H *) -ndefinition set_h_flag_HC08 ≝ -λalu.λhfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - hfl' - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di H *) -ndefinition set_h_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λhfl':bool. - opt_map … (match m return aux_set_typing_opt bool with - [ HC05 ⇒ Some ? set_h_flag_HC05 - | HC08 ⇒ Some ? set_h_flag_HC08 - | HCS08 ⇒ Some ? set_h_flag_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) hfl'))). - -(* setter debole di H *) -ndefinition setweak_h_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λhfl':bool. - match set_h_flag m t s hfl' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* FLAG I *) - -(* setter specifico HC05 di I *) -ndefinition set_i_flag_HC05 ≝ -λalu.λifl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - ifl' - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di I *) -ndefinition set_i_flag_HC08 ≝ -λalu.λifl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - ifl' - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di I *) -ndefinition set_i_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λifl':bool. - opt_map … (match m return aux_set_typing_opt bool with - [ HC05 ⇒ Some ? set_i_flag_HC05 - | HC08 ⇒ Some ? set_i_flag_HC08 - | HCS08 ⇒ Some ? set_i_flag_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) ifl'))). - -(* setter debole di I *) -ndefinition setweak_i_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λifl':bool. - match set_i_flag m t s ifl' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* FLAG N *) - -(* setter specifico HC05 di N *) -ndefinition set_n_flag_HC05 ≝ -λalu.λnfl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - nfl' - (z_flag_HC05 alu) - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di N *) -ndefinition set_n_flag_HC08 ≝ -λalu.λnfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - nfl' - (z_flag_HC08 alu) - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter forte di N *) -ndefinition set_n_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λnfl':bool. - opt_map … (match m return aux_set_typing_opt bool with - [ HC05 ⇒ Some ? set_n_flag_HC05 - | HC08 ⇒ Some ? set_n_flag_HC08 - | HCS08 ⇒ Some ? set_n_flag_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) nfl'))). - -(* setter debole di N *) -ndefinition setweak_n_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λnfl':bool. - match set_n_flag m t s nfl' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* FLAG Z *) - -(* setter specifico HC05 di Z *) -ndefinition set_z_flag_HC05 ≝ -λalu.λzfl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - zfl' - (c_flag_HC05 alu) - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di Z *) -ndefinition set_z_flag_HC08 ≝ -λalu.λzfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - zfl' - (c_flag_HC08 alu) - (irq_flag_HC08 alu). - -(* setter sprcifico RS08 di Z *) -ndefinition set_z_flag_RS08 ≝ -λalu.λzfl':bool. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - (x_map_RS08 alu) - (ps_map_RS08 alu) - zfl' - (c_flag_RS08 alu). - -(* setter forte di Z *) -ndefinition set_z_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λzfl':bool. - set_alu m t s - (match m return aux_set_typing bool with - [ HC05 ⇒ set_z_flag_HC05 - | HC08 ⇒ set_z_flag_HC08 - | HCS08 ⇒ set_z_flag_HC08 - | RS08 ⇒ set_z_flag_RS08 - ] (alu m t s) zfl'). - -(* FLAG C *) - -(* setter specifico HC05 di C *) -ndefinition set_c_flag_HC05 ≝ -λalu.λcfl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - cfl' - (irq_flag_HC05 alu). - -(* setter specifico HC08/HCS08 di C *) -ndefinition set_c_flag_HC08 ≝ -λalu.λcfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - cfl' - (irq_flag_HC08 alu). - -(* setter specifico RS08 di C *) -ndefinition set_c_flag_RS08 ≝ -λalu.λcfl':bool. - mk_alu_RS08 - (acc_low_reg_RS08 alu) - (pc_reg_RS08 alu) - (pc_mask_RS08 alu) - (spc_reg_RS08 alu) - (x_map_RS08 alu) - (ps_map_RS08 alu) - (z_flag_RS08 alu) - cfl'. - -(* setter forte di C *) -ndefinition set_c_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λcfl':bool. - set_alu m t s - (match m return aux_set_typing bool with - [ HC05 ⇒ set_c_flag_HC05 - | HC08 ⇒ set_c_flag_HC08 - | HCS08 ⇒ set_c_flag_HC08 - | RS08 ⇒ set_c_flag_RS08 - ] (alu m t s) cfl'). - -(* FLAG IRQ *) - -(* setter specifico HC05 di IRQ *) -ndefinition set_irq_flag_HC05 ≝ -λalu.λirqfl':bool. - mk_alu_HC05 - (acc_low_reg_HC05 alu) - (indX_low_reg_HC05 alu) - (sp_reg_HC05 alu) - (sp_mask_HC05 alu) - (sp_fix_HC05 alu) - (pc_reg_HC05 alu) - (pc_mask_HC05 alu) - (h_flag_HC05 alu) - (i_flag_HC05 alu) - (n_flag_HC05 alu) - (z_flag_HC05 alu) - (c_flag_HC05 alu) - irqfl'. - -(* setter specifico HC08/HCS08 di IRQ *) -ndefinition set_irq_flag_HC08 ≝ -λalu.λirqfl':bool. - mk_alu_HC08 - (acc_low_reg_HC08 alu) - (indX_low_reg_HC08 alu) - (indX_high_reg_HC08 alu) - (sp_reg_HC08 alu) - (pc_reg_HC08 alu) - (v_flag_HC08 alu) - (h_flag_HC08 alu) - (i_flag_HC08 alu) - (n_flag_HC08 alu) - (z_flag_HC08 alu) - (c_flag_HC08 alu) - irqfl'. - -(* setter forte di IRQ *) -ndefinition set_irq_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λirqfl':bool. - opt_map … (match m return aux_set_typing_opt bool with - [ HC05 ⇒ Some ? set_irq_flag_HC05 - | HC08 ⇒ Some ? set_irq_flag_HC08 - | HCS08 ⇒ Some ? set_irq_flag_HC08 - | RS08 ⇒ None ? ]) - (λf.Some ? (set_alu m t s (f (alu m t s) irqfl'))). - -(* setter debole di IRQ *) -ndefinition setweak_irq_flag ≝ -λm:mcu_type.λt:memory_impl.λs:any_status m t.λirqfl':bool. - match set_irq_flag m t s irqfl' with - [ None ⇒ s | Some s' ⇒ s' ]. - -(* ***************** *) -(* CONFRONTO FRA ALU *) -(* ***************** *) - -(* confronto registro per registro dell'HC05 *) -ndefinition eq_aluHC05 ≝ -λalu1,alu2:alu_HC05. - match alu1 with - [ mk_alu_HC05 acclow1 indxlow1 sp1 spm1 spf1 pc1 pcm1 hfl1 ifl1 nfl1 zfl1 cfl1 irqfl1 ⇒ - match alu2 with - [ mk_alu_HC05 acclow2 indxlow2 sp2 spm2 spf2 pc2 pcm2 hfl2 ifl2 nfl2 zfl2 cfl2 irqfl2 ⇒ - (eq_b8 acclow1 acclow2) ⊗ - (eq_b8 indxlow1 indxlow2) ⊗ - (eq_w16 sp1 sp2) ⊗ - (eq_w16 spm1 spm2) ⊗ - (eq_w16 spf1 spf2) ⊗ - (eq_w16 pc1 pc2) ⊗ - (eq_w16 pcm1 pcm2) ⊗ - (eq_bool hfl1 hfl2) ⊗ - (eq_bool ifl1 ifl2) ⊗ - (eq_bool nfl1 nfl2) ⊗ - (eq_bool zfl1 zfl2) ⊗ - (eq_bool cfl1 cfl2) ⊗ - (eq_bool irqfl1 irqfl2) ]]. - -(* confronto registro per registro dell'HC08 *) -ndefinition eq_aluHC08 ≝ -λalu1,alu2:alu_HC08. - match alu1 with - [ mk_alu_HC08 acclow1 indxlow1 indxhigh1 sp1 pc1 vfl1 hfl1 ifl1 nfl1 zfl1 cfl1 irqfl1 ⇒ - match alu2 with - [ mk_alu_HC08 acclow2 indxlow2 indxhigh2 sp2 pc2 vfl2 hfl2 ifl2 nfl2 zfl2 cfl2 irqfl2 ⇒ - (eq_b8 acclow1 acclow2) ⊗ - (eq_b8 indxlow1 indxlow2) ⊗ - (eq_b8 indxhigh1 indxhigh2) ⊗ - (eq_w16 sp1 sp2) ⊗ - (eq_w16 pc1 pc2) ⊗ - (eq_bool vfl1 vfl2) ⊗ - (eq_bool hfl1 hfl2) ⊗ - (eq_bool ifl1 ifl2) ⊗ - (eq_bool nfl1 nfl2) ⊗ - (eq_bool zfl1 zfl2) ⊗ - (eq_bool cfl1 cfl2) ⊗ - (eq_bool irqfl1 irqfl2) ]]. - -(* confronto registro per registro dell'RS08 *) -ndefinition eq_aluRS08 ≝ -λalu1,alu2:alu_RS08. - match alu1 with - [ mk_alu_RS08 acclow1 pc1 pcm1 spc1 xm1 psm1 zfl1 cfl1 ⇒ - match alu2 with - [ mk_alu_RS08 acclow2 pc2 pcm2 spc2 xm2 psm2 zfl2 cfl2 ⇒ - (eq_b8 acclow1 acclow2) ⊗ - (eq_w16 pc1 pc2) ⊗ - (eq_w16 pcm1 pcm2) ⊗ - (eq_w16 spc1 spc2) ⊗ - (eq_b8 xm1 xm2) ⊗ - (eq_b8 psm1 psm2) ⊗ - (eq_bool zfl1 zfl2) ⊗ - (eq_bool cfl1 cfl2) ]]. - -(* ******************** *) -(* CONFRONTO FRA STATUS *) -(* ******************** *) - -(* confronto di una regione di memoria [addr1 ; ... ; addrn] *) -nlet rec forall_memory_ranged - (t:memory_impl) - (chk1:aux_chk_type t) (chk2:aux_chk_type t) - (mem1:aux_mem_type t) (mem2:aux_mem_type t) - (addrl:list word16) on addrl ≝ - match addrl return λ_.bool with - [ nil ⇒ true - | cons hd tl ⇒ (eq_option byte8 (mem_read t mem1 chk1 hd) - (mem_read t mem2 chk2 hd) eq_b8) ⊗ - (forall_memory_ranged t chk1 chk2 mem1 mem2 tl) - ]. - -(* il clk e' option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16) *) -ndefinition eq_clk ≝ -λm:mcu_type.λc1,c2:option (Prod5T byte8 (any_opcode m) (instr_mode) byte8 word16). - match c1 with - [ None ⇒ match c2 with - [ None ⇒ true | Some _ ⇒ false ] - | Some c1' ⇒ match c2 with - [ None ⇒ false | Some c2' ⇒ (eq_b8 (fst5T … c1') (fst5T … c2')) ⊗ - (eq_anyop m (snd5T … c1') (snd5T … c2')) ⊗ - (eq_im (thd5T … c1') (thd5T … c2')) ⊗ - (eq_b8 (frth5T … c1') (frth5T … c2')) ⊗ - (eq_w16 (ffth5T … c1') (ffth5T … c2')) ] - ]. - -(* generalizzazione del confronto fra stati *) -ndefinition eq_anystatus ≝ -λm:mcu_type.λt:memory_impl.λs1,s2:any_status m t.λaddrl:list word16. - match s1 with [ mk_any_status alu1 mem1 chk1 clk1 ⇒ - match s2 with [ mk_any_status alu2 mem2 chk2 clk2 ⇒ - - (* 1) confronto della ALU *) - (match m return λm:mcu_type. - match m with - [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → - match m with - [ HC05 ⇒ alu_HC05 | HC08 ⇒ alu_HC08 | HCS08 ⇒ alu_HC08 | RS08 ⇒ alu_RS08 ] → - bool with - [ HC05 ⇒ eq_aluHC05 | HC08 ⇒ eq_aluHC08 | HCS08 ⇒ eq_aluHC08 | RS08 ⇒ eq_aluRS08 ] - alu1 alu2) ⊗ - - (* 2) confronto della memoria in [inf,inf+n] *) - (forall_memory_ranged t chk1 chk2 mem1 mem2 addrl) ⊗ - - (* 3) confronto del clik *) - (eq_clk m clk1 clk2) - ]]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/status_lemmas.ma b/helm/software/matita/contribs/ng_assembly/freescale/status_lemmas.ma deleted file mode 100755 index 0be7272db..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/status_lemmas.ma +++ /dev/null @@ -1,1536 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "num/word16_lemmas.ma". -include "freescale/opcode_base_lemmas1.ma". -include "freescale/status.ma". -include "common/option_lemmas.ma". -include "common/prod_lemmas.ma". - -(* *********************************** *) -(* STATUS INTERNO DEL PROCESSORE (ALU) *) -(* *********************************** *) - -nlemma aluHC05_destruct_1 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x1 = y1. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 a _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_2 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x2 = y2. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ a _ _ _ _ _ _ _ _ _ _ _ ⇒ x2 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_3 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x3 = y3. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ a _ _ _ _ _ _ _ _ _ _ ⇒ x3 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_4 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x4 = y4. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ a _ _ _ _ _ _ _ _ _ ⇒ x4 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_5 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x5 = y5. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ a _ _ _ _ _ _ _ _ ⇒ x5 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_6 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x6 = y6. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ a _ _ _ _ _ _ _ ⇒ x6 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_7 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x7 = y7. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ a _ _ _ _ _ _ ⇒ x7 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_8 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x8 = y8. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ a _ _ _ _ _ ⇒ x8 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_9 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x9 = y9. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ _ a _ _ _ _ ⇒ x9 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_10 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x10 = y10. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ _ _ a _ _ _ ⇒ x10 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_11 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x11 = y11. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ _ _ _ a _ _ ⇒ x11 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_12 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x12 = y12. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ _ _ _ _ a _ ⇒ x12 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC05_destruct_13 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 = mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 → - x13 = y13. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange with (match mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 - with [ mk_alu_HC05 _ _ _ _ _ _ _ _ _ _ _ _ a ⇒ x13 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqaluHC05 : symmetricT alu_HC05 bool eq_aluHC05. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nchange with ( - ((eq_b8 x1 y1) ⊗ (eq_b8 x2 y2) ⊗ (eq_w16 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_w16 x5 y5) ⊗ (eq_w16 x6 y6) ⊗ (eq_w16 x7 y7) ⊗ (eq_bool x8 y8) ⊗ - (eq_bool x9 y9) ⊗ (eq_bool x10 y10) ⊗ (eq_bool x11 y11) ⊗ (eq_bool x12 y12) ⊗ - (eq_bool x13 y13)) = ((eq_b8 y1 x1) ⊗ (eq_b8 y2 x2) ⊗ (eq_w16 y3 x3) ⊗ - (eq_w16 y4 x4) ⊗ (eq_w16 y5 x5) ⊗ (eq_w16 y6 x6) ⊗ (eq_w16 y7 x7) ⊗ - (eq_bool y8 x8) ⊗ (eq_bool y9 x9) ⊗ (eq_bool y10 x10) ⊗ (eq_bool y11 x11) ⊗ - (eq_bool y12 x12) ⊗ (eq_bool y13 x13))); - nrewrite > (symmetric_eqb8 x1 y1); - nrewrite > (symmetric_eqb8 x2 y2); - nrewrite > (symmetric_eqw16 x3 y3); - nrewrite > (symmetric_eqw16 x4 y4); - nrewrite > (symmetric_eqw16 x5 y5); - nrewrite > (symmetric_eqw16 x6 y6); - nrewrite > (symmetric_eqw16 x7 y7); - nrewrite > (symmetric_eqbool x8 y8); - nrewrite > (symmetric_eqbool x9 y9); - nrewrite > (symmetric_eqbool x10 y10); - nrewrite > (symmetric_eqbool x11 y11); - nrewrite > (symmetric_eqbool x12 y12); - nrewrite > (symmetric_eqbool x13 y13); - napply refl_eq. -nqed. - -nlemma eqaluHC05_to_eq : ∀alu1,alu2.eq_aluHC05 alu1 alu2 = true → alu1 = alu2. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nchange in H:(%) with ( - ((eq_b8 x1 y1) ⊗ (eq_b8 x2 y2) ⊗ - (eq_w16 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_w16 x5 y5) ⊗ (eq_w16 x6 y6) ⊗ - (eq_w16 x7 y7) ⊗ (eq_bool x8 y8) ⊗ - (eq_bool x9 y9) ⊗ (eq_bool x10 y10) ⊗ - (eq_bool x11 y11) ⊗ (eq_bool x12 y12) ⊗ - (eq_bool x13 y13)) = true); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H)); - nletin H1 ≝ (andb_true_true_l … H); - nrewrite > (eqbool_to_eq x12 y12 (andb_true_true_r … (andb_true_true_l … H))); - nletin H2 ≝ (andb_true_true_l … H1); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H2)); - nletin H3 ≝ (andb_true_true_l … H2); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H3)); - nletin H4 ≝ (andb_true_true_l … H3); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H4)); - nletin H5 ≝ (andb_true_true_l … H4); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H5)); - nletin H6 ≝ (andb_true_true_l … H5); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H6)); - nletin H7 ≝ (andb_true_true_l … H6); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H7)); - nletin H8 ≝ (andb_true_true_l … H7); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H8)); - nletin H9 ≝ (andb_true_true_l … H8); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H9)); - nletin H10 ≝ (andb_true_true_l … H9); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H10)); - nletin H11 ≝ (andb_true_true_l … H10); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H11)); - nrewrite > (eqb8_to_eq … (andb_true_true_l … H11)); - napply refl_eq. -nqed. - -nlemma eq_to_eqaluHC05 : ∀alu1,alu2.alu1 = alu2 → eq_aluHC05 alu1 alu2 = true. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #H; - nrewrite > (aluHC05_destruct_1 … H); - nrewrite > (aluHC05_destruct_2 … H); - nrewrite > (aluHC05_destruct_3 … H); - nrewrite > (aluHC05_destruct_4 … H); - nrewrite > (aluHC05_destruct_5 … H); - nrewrite > (aluHC05_destruct_6 … H); - nrewrite > (aluHC05_destruct_7 … H); - nrewrite > (aluHC05_destruct_8 … H); - nrewrite > (aluHC05_destruct_9 … H); - nrewrite > (aluHC05_destruct_10 … H); - nrewrite > (aluHC05_destruct_11 … H); - nrewrite > (aluHC05_destruct_12 … H); - nrewrite > (aluHC05_destruct_13 … H); - nchange with ( - ((eq_b8 y1 y1) ⊗ (eq_b8 y2 y2) ⊗ - (eq_w16 y3 y3) ⊗ (eq_w16 y4 y4) ⊗ - (eq_w16 y5 y5) ⊗ (eq_w16 y6 y6) ⊗ - (eq_w16 y7 y7) ⊗ (eq_bool y8 y8) ⊗ - (eq_bool y9 y9) ⊗ (eq_bool y10 y10) ⊗ - (eq_bool y11 y11) ⊗ (eq_bool y12 y12) ⊗ - (eq_bool y13 y13)) = true); - nrewrite > (eq_to_eqb8 y1 y1 (refl_eq …)); - nrewrite > (eq_to_eqb8 y2 y2 (refl_eq …)); - nrewrite > (eq_to_eqw16 y3 y3 (refl_eq …)); - nrewrite > (eq_to_eqw16 y4 y4 (refl_eq …)); - nrewrite > (eq_to_eqw16 y5 y5 (refl_eq …)); - nrewrite > (eq_to_eqw16 y6 y6 (refl_eq …)); - nrewrite > (eq_to_eqw16 y7 y7 (refl_eq …)); - nrewrite > (eq_to_eqbool y8 y8 (refl_eq …)); - nrewrite > (eq_to_eqbool y9 y9 (refl_eq …)); - nrewrite > (eq_to_eqbool y10 y10 (refl_eq …)); - nrewrite > (eq_to_eqbool y11 y11 (refl_eq …)); - nrewrite > (eq_to_eqbool y12 y12 (refl_eq …)); - nrewrite > (eq_to_eqbool y13 y13 (refl_eq …)); - napply refl_eq. -nqed. - -nlemma decidable_aluHC05_aux1 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x1 ≠ y1) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_1 … H1)). -nqed. - -nlemma decidable_aluHC05_aux2 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x2 ≠ y2) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_2 … H1)). -nqed. - -nlemma decidable_aluHC05_aux3 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x3 ≠ y3) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_3 … H1)). -nqed. - -nlemma decidable_aluHC05_aux4 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x4 ≠ y4) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_4 … H1)). -nqed. - -nlemma decidable_aluHC05_aux5 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x5 ≠ y5) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_5 … H1)). -nqed. - -nlemma decidable_aluHC05_aux6 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x6 ≠ y6) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_6 … H1)). -nqed. - -nlemma decidable_aluHC05_aux7 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x7 ≠ y7) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_7 … H1)). -nqed. - -nlemma decidable_aluHC05_aux8 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x8 ≠ y8) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_8 … H1)). -nqed. - -nlemma decidable_aluHC05_aux9 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x9 ≠ y9) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_9 … H1)). -nqed. - -nlemma decidable_aluHC05_aux10 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x10 ≠ y10) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_10 … H1)). -nqed. - -nlemma decidable_aluHC05_aux11 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x11 ≠ y11) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_11 … H1)). -nqed. - -nlemma decidable_aluHC05_aux12 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x12 ≠ y12) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_12 … H1)). -nqed. - -nlemma decidable_aluHC05_aux13 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13. - (x13 ≠ y13) → - (mk_alu_HC05 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13) ≠ - (mk_alu_HC05 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; #H; #H1; - napply (H (aluHC05_destruct_13 … H1)). -nqed. - -nlemma decidable_aluHC05 : ∀x,y:alu_HC05.decidable (x = y). - #x; nelim x; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; - #y; nelim y; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; - nnormalize; - napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x1 y1) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_aluHC05_aux1 … H)) - ##| ##1: #H; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x2 y2) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_aluHC05_aux2 … H1)) - ##| ##1: #H1; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x3 y3) …); - ##[ ##2: #H2; napply (or2_intro2 … (decidable_aluHC05_aux3 … H2)) - ##| ##1: #H2; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x4 y4) …); - ##[ ##2: #H3; napply (or2_intro2 … (decidable_aluHC05_aux4 … H3)) - ##| ##1: #H3; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x5 y5) …); - ##[ ##2: #H4; napply (or2_intro2 … (decidable_aluHC05_aux5 … H4)) - ##| ##1: #H4; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x6 y6) …); - ##[ ##2: #H5; napply (or2_intro2 … (decidable_aluHC05_aux6 … H5)) - ##| ##1: #H5; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x7 y7) …); - ##[ ##2: #H6; napply (or2_intro2 … (decidable_aluHC05_aux7 … H6)) - ##| ##1: #H6; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x8 y8) …); - ##[ ##2: #H7; napply (or2_intro2 … (decidable_aluHC05_aux8 … H7)) - ##| ##1: #H7; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x9 y9) …); - ##[ ##2: #H8; napply (or2_intro2 … (decidable_aluHC05_aux9 … H8)) - ##| ##1: #H8; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x10 y10) …); - ##[ ##2: #H9; napply (or2_intro2 … (decidable_aluHC05_aux10 … H9)) - ##| ##1: #H9; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x11 y11) …); - ##[ ##2: #H10; napply (or2_intro2 … (decidable_aluHC05_aux11 … H10)) - ##| ##1: #H10; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x12 y12) …); - ##[ ##2: #H11; napply (or2_intro2 … (decidable_aluHC05_aux12 … H11)) - ##| ##1: #H11; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x13 y13) …); - ##[ ##2: #H12; napply (or2_intro2 … (decidable_aluHC05_aux13 … H12)) - ##| ##1: #H12; nrewrite > H; nrewrite > H1; nrewrite > H2; nrewrite > H3; - nrewrite > H4; nrewrite > H5; nrewrite > H6; nrewrite > H7; - nrewrite > H8; nrewrite > H9; nrewrite > H10; nrewrite > H11; - nrewrite > H12; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] -nqed. - -nlemma aluHC08_destruct_1 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x1 = y1. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 a _ _ _ _ _ _ _ _ _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_2 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x2 = y2. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ a _ _ _ _ _ _ _ _ _ _ ⇒ x2 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_3 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x3 = y3. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ a _ _ _ _ _ _ _ _ _ ⇒ x3 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_4 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x4 = y4. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ a _ _ _ _ _ _ _ _ ⇒ x4 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_5 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x5 = y5. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ a _ _ _ _ _ _ _ ⇒ x5 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_6 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x6 = y6. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ a _ _ _ _ _ _ ⇒ x6 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_7 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x7 = y7. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ a _ _ _ _ _ ⇒ x7 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_8 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x8 = y8. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ _ a _ _ _ _ ⇒ x8 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_9 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x9 = y9. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ _ _ a _ _ _ ⇒ x9 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_10 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x10 = y10. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ _ _ _ a _ _ ⇒ x10 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_11 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x11 = y11. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ _ _ _ _ a _ ⇒ x11 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluHC08_destruct_12 : -∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 = mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 → - x12 = y12. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange with (match mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 - with [ mk_alu_HC08 _ _ _ _ _ _ _ _ _ _ _ a ⇒ x12 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqaluHC08 : symmetricT alu_HC08 bool eq_aluHC08. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nchange with ( - ((eq_b8 x1 y1) ⊗ (eq_b8 x2 y2) ⊗ (eq_b8 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_w16 x5 y5) ⊗ (eq_bool x6 y6) ⊗ (eq_bool x7 y7) ⊗ (eq_bool x8 y8) ⊗ - (eq_bool x9 y9) ⊗ (eq_bool x10 y10) ⊗ (eq_bool x11 y11) ⊗ (eq_bool x12 y12)) = - ((eq_b8 y1 x1) ⊗ (eq_b8 y2 x2) ⊗ (eq_b8 y3 x3) ⊗ (eq_w16 y4 x4) ⊗ - (eq_w16 y5 x5) ⊗ (eq_bool y6 x6) ⊗ (eq_bool y7 x7) ⊗ (eq_bool y8 x8) ⊗ - (eq_bool y9 x9) ⊗ (eq_bool y10 x10) ⊗ (eq_bool y11 x11) ⊗ (eq_bool y12 x12))); - nrewrite > (symmetric_eqb8 x1 y1); - nrewrite > (symmetric_eqb8 x2 y2); - nrewrite > (symmetric_eqb8 x3 y3); - nrewrite > (symmetric_eqw16 x4 y4); - nrewrite > (symmetric_eqw16 x5 y5); - nrewrite > (symmetric_eqbool x6 y6); - nrewrite > (symmetric_eqbool x7 y7); - nrewrite > (symmetric_eqbool x8 y8); - nrewrite > (symmetric_eqbool x9 y9); - nrewrite > (symmetric_eqbool x10 y10); - nrewrite > (symmetric_eqbool x11 y11); - nrewrite > (symmetric_eqbool x12 y12); - napply refl_eq. -nqed. - -nlemma eqaluHC08_to_eq : ∀alu1,alu2.eq_aluHC08 alu1 alu2 = true → alu1 = alu2. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nchange in H:(%) with ( - ((eq_b8 x1 y1) ⊗ (eq_b8 x2 y2) ⊗ (eq_b8 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_w16 x5 y5) ⊗ (eq_bool x6 y6) ⊗ (eq_bool x7 y7) ⊗ (eq_bool x8 y8) ⊗ - (eq_bool x9 y9) ⊗ (eq_bool x10 y10) ⊗ (eq_bool x11 y11) ⊗ (eq_bool x12 y12)) = true); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H)); - nletin H1 ≝ (andb_true_true_l … H); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H1)); - nletin H2 ≝ (andb_true_true_l … H1); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H2)); - nletin H3 ≝ (andb_true_true_l … H2); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H3)); - nletin H4 ≝ (andb_true_true_l … H3); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H4)); - nletin H5 ≝ (andb_true_true_l … H4); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H5)); - nletin H6 ≝ (andb_true_true_l … H5); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H6)); - nletin H7 ≝ (andb_true_true_l … H6); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H7)); - nletin H8 ≝ (andb_true_true_l … H7); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H8)); - nletin H9 ≝ (andb_true_true_l … H8); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H9)); - nletin H10 ≝ (andb_true_true_l … H9); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H10)); - nrewrite > (eqb8_to_eq … (andb_true_true_l … H10)); - napply refl_eq. -nqed. - -nlemma eq_to_eqaluHC08 : ∀alu1,alu2.alu1 = alu2 → eq_aluHC08 alu1 alu2 = true. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #H; - nrewrite > (aluHC08_destruct_1 … H); - nrewrite > (aluHC08_destruct_2 … H); - nrewrite > (aluHC08_destruct_3 … H); - nrewrite > (aluHC08_destruct_4 … H); - nrewrite > (aluHC08_destruct_5 … H); - nrewrite > (aluHC08_destruct_6 … H); - nrewrite > (aluHC08_destruct_7 … H); - nrewrite > (aluHC08_destruct_8 … H); - nrewrite > (aluHC08_destruct_9 … H); - nrewrite > (aluHC08_destruct_10 … H); - nrewrite > (aluHC08_destruct_11 … H); - nrewrite > (aluHC08_destruct_12 … H); - nchange with ( - ((eq_b8 y1 y1) ⊗ (eq_b8 y2 y2) ⊗ (eq_b8 y3 y3) ⊗ (eq_w16 y4 y4) ⊗ - (eq_w16 y5 y5) ⊗ (eq_bool y6 y6) ⊗ (eq_bool y7 y7) ⊗ (eq_bool y8 y8) ⊗ - (eq_bool y9 y9) ⊗ (eq_bool y10 y10) ⊗ (eq_bool y11 y11) ⊗ (eq_bool y12 y12)) = true); - nrewrite > (eq_to_eqb8 y1 y1 (refl_eq …)); - nrewrite > (eq_to_eqb8 y2 y2 (refl_eq …)); - nrewrite > (eq_to_eqb8 y3 y3 (refl_eq …)); - nrewrite > (eq_to_eqw16 y4 y4 (refl_eq …)); - nrewrite > (eq_to_eqw16 y5 y5 (refl_eq …)); - nrewrite > (eq_to_eqbool y6 y6 (refl_eq …)); - nrewrite > (eq_to_eqbool y7 y7 (refl_eq …)); - nrewrite > (eq_to_eqbool y8 y8 (refl_eq …)); - nrewrite > (eq_to_eqbool y9 y9 (refl_eq …)); - nrewrite > (eq_to_eqbool y10 y10 (refl_eq …)); - nrewrite > (eq_to_eqbool y11 y11 (refl_eq …)); - nrewrite > (eq_to_eqbool y12 y12 (refl_eq …)); - napply refl_eq. -nqed. - -nlemma decidable_aluHC08_aux1 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x1 ≠ y1) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_1 … H1)). -nqed. - -nlemma decidable_aluHC08_aux2 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x2 ≠ y2) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_2 … H1)). -nqed. - -nlemma decidable_aluHC08_aux3 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x3 ≠ y3) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_3 … H1)). -nqed. - -nlemma decidable_aluHC08_aux4 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x4 ≠ y4) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_4 … H1)). -nqed. - -nlemma decidable_aluHC08_aux5 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x5 ≠ y5) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_5 … H1)). -nqed. - -nlemma decidable_aluHC08_aux6 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x6 ≠ y6) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_6 … H1)). -nqed. - -nlemma decidable_aluHC08_aux7 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x7 ≠ y7) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_7 … H1)). -nqed. - -nlemma decidable_aluHC08_aux8 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x8 ≠ y8) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_8 … H1)). -nqed. - -nlemma decidable_aluHC08_aux9 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x9 ≠ y9) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_9 … H1)). -nqed. - -nlemma decidable_aluHC08_aux10 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x10 ≠ y10) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_10 … H1)). -nqed. - -nlemma decidable_aluHC08_aux11 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x11 ≠ y11) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_11 … H1)). -nqed. - -nlemma decidable_aluHC08_aux12 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12. - (x12 ≠ y12) → - (mk_alu_HC08 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12) ≠ - (mk_alu_HC08 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; #H; #H1; - napply (H (aluHC08_destruct_12 … H1)). -nqed. - -nlemma decidable_aluHC08 : ∀x,y:alu_HC08.decidable (x = y). - #x; nelim x; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; - #y; nelim y; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; - nnormalize; - napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x1 y1) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_aluHC08_aux1 … H)) - ##| ##1: #H; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x2 y2) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_aluHC08_aux2 … H1)) - ##| ##1: #H1; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x3 y3) …); - ##[ ##2: #H2; napply (or2_intro2 … (decidable_aluHC08_aux3 … H2)) - ##| ##1: #H2; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x4 y4) …); - ##[ ##2: #H3; napply (or2_intro2 … (decidable_aluHC08_aux4 … H3)) - ##| ##1: #H3; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x5 y5) …); - ##[ ##2: #H4; napply (or2_intro2 … (decidable_aluHC08_aux5 … H4)) - ##| ##1: #H4; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x6 y6) …); - ##[ ##2: #H5; napply (or2_intro2 … (decidable_aluHC08_aux6 … H5)) - ##| ##1: #H5; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x7 y7) …); - ##[ ##2: #H6; napply (or2_intro2 … (decidable_aluHC08_aux7 … H6)) - ##| ##1: #H6; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x8 y8) …); - ##[ ##2: #H7; napply (or2_intro2 … (decidable_aluHC08_aux8 … H7)) - ##| ##1: #H7; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x9 y9) …); - ##[ ##2: #H8; napply (or2_intro2 … (decidable_aluHC08_aux9 … H8)) - ##| ##1: #H8; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x10 y10) …); - ##[ ##2: #H9; napply (or2_intro2 … (decidable_aluHC08_aux10 … H9)) - ##| ##1: #H9; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x11 y11) …); - ##[ ##2: #H10; napply (or2_intro2 … (decidable_aluHC08_aux11 … H10)) - ##| ##1: #H10; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x12 y12) …); - ##[ ##2: #H11; napply (or2_intro2 … (decidable_aluHC08_aux12 … H11)) - ##| ##1: #H11; nrewrite > H; nrewrite > H1; nrewrite > H2; nrewrite > H3; - nrewrite > H4; nrewrite > H5; nrewrite > H6; nrewrite > H7; - nrewrite > H8; nrewrite > H9; nrewrite > H10; nrewrite > H11; - napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] -nqed. - -nlemma aluRS08_destruct_1 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x1 = y1. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 a _ _ _ _ _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_2 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x2 = y2. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ a _ _ _ _ _ _ ⇒ x2 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_3 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x3 = y3. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ a _ _ _ _ _ ⇒ x3 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_4 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x4 = y4. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ _ a _ _ _ _ ⇒ x4 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_5 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x5 = y5. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ _ _ a _ _ _ ⇒ x5 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_6 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x6 = y6. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ _ _ _ a _ _ ⇒ x6 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_7 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x7 = y7. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ _ _ _ _ a _ ⇒ x7 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma aluRS08_destruct_8 : -∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8 = mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 → - x8 = y8. - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange with (match mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8 - with [ mk_alu_RS08 _ _ _ _ _ _ _ a ⇒ x8 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqaluRS08 : symmetricT alu_RS08 bool eq_aluRS08. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nchange with ( - ((eq_b8 x1 y1) ⊗ (eq_w16 x2 y2) ⊗ - (eq_w16 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_b8 x5 y5) ⊗ (eq_b8 x6 y6) ⊗ - (eq_bool x7 y7) ⊗ (eq_bool x8 y8)) = - ((eq_b8 y1 x1) ⊗ (eq_w16 y2 x2) ⊗ - (eq_w16 y3 x3) ⊗ (eq_w16 y4 x4) ⊗ - (eq_b8 y5 x5) ⊗ (eq_b8 y6 x6) ⊗ - (eq_bool y7 x7) ⊗ (eq_bool y8 x8))); - nrewrite > (symmetric_eqb8 x1 y1); - nrewrite > (symmetric_eqw16 x2 y2); - nrewrite > (symmetric_eqw16 x3 y3); - nrewrite > (symmetric_eqw16 x4 y4); - nrewrite > (symmetric_eqb8 x5 y5); - nrewrite > (symmetric_eqb8 x6 y6); - nrewrite > (symmetric_eqbool x7 y7); - nrewrite > (symmetric_eqbool x8 y8); - napply refl_eq. -nqed. - -nlemma eqaluRS08_to_eq : ∀alu1,alu2.eq_aluRS08 alu1 alu2 = true → alu1 = alu2. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nchange in H:(%) with ( - ((eq_b8 x1 y1) ⊗ (eq_w16 x2 y2) ⊗ - (eq_w16 x3 y3) ⊗ (eq_w16 x4 y4) ⊗ - (eq_b8 x5 y5) ⊗ (eq_b8 x6 y6) ⊗ - (eq_bool x7 y7) ⊗ (eq_bool x8 y8)) = true); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H)); - nletin H1 ≝ (andb_true_true_l … H); - nrewrite > (eqbool_to_eq … (andb_true_true_r … H1)); - nletin H2 ≝ (andb_true_true_l … H1); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H2)); - nletin H3 ≝ (andb_true_true_l … H2); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H3)); - nletin H4 ≝ (andb_true_true_l … H3); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H4)); - nletin H5 ≝ (andb_true_true_l … H4); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H5)); - nletin H6 ≝ (andb_true_true_l … H5); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H6)); - nrewrite > (eqb8_to_eq … (andb_true_true_l … H6)); - napply refl_eq. -nqed. - -nlemma eq_to_eqaluRS08 : ∀alu1,alu2.alu1 = alu2 → eq_aluRS08 alu1 alu2 = true. - #alu1; #alu2; - ncases alu1; - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - ncases alu2; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; - nrewrite > (aluRS08_destruct_1 … H); - nrewrite > (aluRS08_destruct_2 … H); - nrewrite > (aluRS08_destruct_3 … H); - nrewrite > (aluRS08_destruct_4 … H); - nrewrite > (aluRS08_destruct_5 … H); - nrewrite > (aluRS08_destruct_6 … H); - nrewrite > (aluRS08_destruct_7 … H); - nrewrite > (aluRS08_destruct_8 … H); - nchange with ( - ((eq_b8 y1 y1) ⊗ (eq_w16 y2 y2) ⊗ - (eq_w16 y3 y3) ⊗ (eq_w16 y4 y4) ⊗ - (eq_b8 y5 y5) ⊗ (eq_b8 y6 y6) ⊗ - (eq_bool y7 y7) ⊗ (eq_bool y8 y8)) = true); - nrewrite > (eq_to_eqb8 y1 y1 (refl_eq …)); - nrewrite > (eq_to_eqw16 y2 y2 (refl_eq …)); - nrewrite > (eq_to_eqw16 y3 y3 (refl_eq …)); - nrewrite > (eq_to_eqw16 y4 y4 (refl_eq …)); - nrewrite > (eq_to_eqb8 y5 y5 (refl_eq …)); - nrewrite > (eq_to_eqb8 y6 y6 (refl_eq …)); - nrewrite > (eq_to_eqbool y7 y7 (refl_eq …)); - nrewrite > (eq_to_eqbool y8 y8 (refl_eq …)); - napply refl_eq. -nqed. - -nlemma decidable_aluRS08_aux1 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x1 ≠ y1) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_1 … H1)). -nqed. - -nlemma decidable_aluRS08_aux2 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x2 ≠ y2) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_2 … H1)). -nqed. - -nlemma decidable_aluRS08_aux3 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x3 ≠ y3) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_3 … H1)). -nqed. - -nlemma decidable_aluRS08_aux4 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x4 ≠ y4) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_4 … H1)). -nqed. - -nlemma decidable_aluRS08_aux5 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x5 ≠ y5) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_5 … H1)). -nqed. - -nlemma decidable_aluRS08_aux6 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x6 ≠ y6) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_6 … H1)). -nqed. - -nlemma decidable_aluRS08_aux7 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x7 ≠ y7) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_7 … H1)). -nqed. - -nlemma decidable_aluRS08_aux8 - : ∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8. - (x8 ≠ y8) → - (mk_alu_RS08 x1 x2 x3 x4 x5 x6 x7 x8) ≠ - (mk_alu_RS08 y1 y2 y3 y4 y5 y6 y7 y8). - #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; #H; #H1; - napply (H (aluRS08_destruct_8 … H1)). -nqed. - -nlemma decidable_aluRS08 : ∀x,y:alu_RS08.decidable (x = y). - #x; nelim x; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; - #y; nelim y; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; - nnormalize; - napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x1 y1) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_aluRS08_aux1 … H)) - ##| ##1: #H; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x2 y2) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_aluRS08_aux2 … H1)) - ##| ##1: #H1; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x3 y3) …); - ##[ ##2: #H2; napply (or2_intro2 … (decidable_aluRS08_aux3 … H2)) - ##| ##1: #H2; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 x4 y4) …); - ##[ ##2: #H3; napply (or2_intro2 … (decidable_aluRS08_aux4 … H3)) - ##| ##1: #H3; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x5 y5) …); - ##[ ##2: #H4; napply (or2_intro2 … (decidable_aluRS08_aux5 … H4)) - ##| ##1: #H4; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 x6 y6) …); - ##[ ##2: #H5; napply (or2_intro2 … (decidable_aluRS08_aux6 … H5)) - ##| ##1: #H5; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x7 y7) …); - ##[ ##2: #H6; napply (or2_intro2 … (decidable_aluRS08_aux7 … H6)) - ##| ##1: #H6; napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_bool x8 y8) …); - ##[ ##2: #H7; napply (or2_intro2 … (decidable_aluRS08_aux8 … H7)) - ##| ##1: #H7; nrewrite > H; nrewrite > H1; nrewrite > H2; nrewrite > H3; - nrewrite > H4; nrewrite > H5; nrewrite > H6; nrewrite > H7; - napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##] - ##] - ##] - ##] - ##] - ##] - ##] - ##] -nqed. - -nlemma symmetric_eqclk : ∀mcu,clk1,clk2.eq_clk mcu clk1 clk2 = eq_clk mcu clk2 clk1. - #mcu; #clk1; #clk2; - ncases clk1; - ncases clk2; - ##[ ##1: napply refl_eq - ##| ##2,3: nnormalize; #H; napply refl_eq - ##| ##4: #p1; ncases p1; #x1; #x2; #x3; #x4; #x5; - #p2; ncases p2; #y1; #y2; #y3; #y4; #y5; - nchange with ( - ((eq_b8 y1 x1) ⊗ (eq_anyop ? y2 x2) ⊗ (eq_im y3 x3) ⊗ (eq_b8 y4 x4) ⊗ (eq_w16 y5 x5)) = - ((eq_b8 x1 y1) ⊗ (eq_anyop ? x2 y2) ⊗ (eq_im x3 y3) ⊗ (eq_b8 x4 y4) ⊗ (eq_w16 x5 y5))); - nrewrite > (symmetric_eqb8 x1 y1); - nrewrite > (symmetric_eqanyop ? x2 y2); - nrewrite > (symmetric_eqim x3 y3); - nrewrite > (symmetric_eqb8 x4 y4); - nrewrite > (symmetric_eqw16 x5 y5); - napply refl_eq - ##] -nqed. - -nlemma eqclk_to_eq : ∀mcu,clk1,clk2.eq_clk mcu clk1 clk2 = true → clk1 = clk2. - #mcu; #clk1; #clk2; - ncases clk1; - ncases clk2; - ##[ ##1: nnormalize; #H; napply refl_eq - ##| ##2,3: nnormalize; #H; #H1; napply (bool_destruct … H1) - ##| ##4: #p1; ncases p1; #x1; #x2; #x3; #x4; #x5; - #p2; ncases p2; #y1; #y2; #y3; #y4; #y5; #H; - nchange in H:(%) with ( - ((eq_b8 y1 x1) ⊗ (eq_anyop ? y2 x2) ⊗ (eq_im y3 x3) ⊗ (eq_b8 y4 x4) ⊗ (eq_w16 y5 x5)) = true); - nrewrite > (eqw16_to_eq … (andb_true_true_r … H)); - nletin H1 ≝ (andb_true_true_l … H); - nrewrite > (eqb8_to_eq … (andb_true_true_r … H1)); - nletin H2 ≝ (andb_true_true_l … H1); - nrewrite > (eqim_to_eq … (andb_true_true_r … H2)); - nletin H3 ≝ (andb_true_true_l … H2); - nrewrite > (eqanyop_to_eq … (andb_true_true_r … H3)); - nrewrite > (eqb8_to_eq … (andb_true_true_l … H3)); - napply refl_eq - ##] -nqed. - -nlemma eq_to_eqclk : ∀mcu,clk1,clk2.clk1 = clk2 → eq_clk mcu clk1 clk2 = true. - #mcu; #clk1; #clk2; - ncases clk1; - ncases clk2; - ##[ ##1: nnormalize; #H; napply refl_eq - ##| ##2: nnormalize; #p; #H1; nelim (option_destruct_none_some ? p … H1) - ##| ##3: nnormalize; #p; #H1; nelim (option_destruct_some_none ? p … H1) - ##| ##4: #p1; ncases p1; #x1; #x2; #x3; #x4; #x5; - #p2; ncases p2; #y1; #y2; #y3; #y4; #y5; #H; - nrewrite > (quintuple_destruct_1 … (option_destruct_some_some … H)); - nrewrite > (quintuple_destruct_2 … (option_destruct_some_some … H)); - nrewrite > (quintuple_destruct_3 … (option_destruct_some_some … H)); - nrewrite > (quintuple_destruct_4 … (option_destruct_some_some … H)); - nrewrite > (quintuple_destruct_5 … (option_destruct_some_some … H)); - nchange with ( - ((eq_b8 x1 x1) ⊗ (eq_anyop ? x2 x2) ⊗ (eq_im x3 x3) ⊗ (eq_b8 x4 x4) ⊗ (eq_w16 x5 x5)) = true); - nrewrite > (eq_to_eqb8 x1 x1 (refl_eq …)); - nrewrite > (eq_to_eqanyop mcu x2 x2 (refl_eq ? x2)); - nrewrite > (eq_to_eqim x3 x3 (refl_eq …)); - nrewrite > (eq_to_eqb8 x4 x4 (refl_eq …)); - nrewrite > (eq_to_eqw16 x5 x5 (refl_eq …)); - nnormalize; - napply refl_eq - ##] -nqed. - -nlemma symmetric_forallmemoryranged : -∀t.∀chk1,chk2:aux_chk_type t.∀mem1,mem2:aux_mem_type t.∀addrl. - forall_memory_ranged t chk1 chk2 mem1 mem2 addrl = - forall_memory_ranged t chk2 chk1 mem2 mem1 addrl. - #t; #chk1; #chk2; #mem1; #mem2; #addrl; - napply (list_ind word16 … addrl); - ##[ ##1: nnormalize; napply refl_eq - ##| ##2: #a; #l; #H; - nchange with ( - ((eq_option byte8 (mem_read t mem1 chk1 a) - (mem_read t mem2 chk2 a) eq_b8) ⊗ - (forall_memory_ranged t chk1 chk2 mem1 mem2 l)) = - ((eq_option byte8 (mem_read t mem2 chk2 a) - (mem_read t mem1 chk1 a) eq_b8) ⊗ - (forall_memory_ranged t chk2 chk1 mem2 mem1 l))); - nrewrite > H; - nrewrite > (symmetric_eqoption ? (mem_read t mem1 chk1 a) (mem_read t mem2 chk2 a) eq_b8 symmetric_eqb8); - napply refl_eq - ##] -nqed. - -nlemma anystatus_destruct_1 : -∀m,t.∀x1,x2,x3,x4,y1,y2,y3,y4. - mk_any_status m t x1 x2 x3 x4 = mk_any_status m t y1 y2 y3 y4 → - x1 = y1. - #m; #t; - #x1; #x2; #x3; #x4; - #y1; #y2; #y3; #y4; #H; - nchange with (match mk_any_status m t y1 y2 y3 y4 - with [ mk_any_status a _ _ _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma anystatus_destruct_2 : -∀m,t.∀x1,x2,x3,x4,y1,y2,y3,y4. - mk_any_status m t x1 x2 x3 x4 = mk_any_status m t y1 y2 y3 y4 → - x2 = y2. - #m; #t; - #x1; #x2; #x3; #x4; - #y1; #y2; #y3; #y4; #H; - nchange with (match mk_any_status m t y1 y2 y3 y4 - with [ mk_any_status _ a _ _ ⇒ x2 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma anystatus_destruct_3 : -∀m,t.∀x1,x2,x3,x4,y1,y2,y3,y4. - mk_any_status m t x1 x2 x3 x4 = mk_any_status m t y1 y2 y3 y4 → - x3 = y3. - #m; #t; - #x1; #x2; #x3; #x4; - #y1; #y2; #y3; #y4; #H; - nchange with (match mk_any_status m t y1 y2 y3 y4 - with [ mk_any_status _ _ a _ ⇒ x3 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma anystatus_destruct_4 : -∀m,t.∀x1,x2,x3,x4,y1,y2,y3,y4. - mk_any_status m t x1 x2 x3 x4 = mk_any_status m t y1 y2 y3 y4 → - x4 = y4. - #m; #t; - #x1; #x2; #x3; #x4; - #y1; #y2; #y3; #y4; #H; - nchange with (match mk_any_status m t y1 y2 y3 y4 - with [ mk_any_status _ _ _ a ⇒ x4 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqanystatus : -∀addrl:list word16.∀m:mcu_type.∀t:memory_impl.∀s1,s2:any_status m t. - eq_anystatus m t s1 s2 addrl = eq_anystatus m t s2 s1 addrl. - #addrl; #m; - ncases m; #t; #s1; - ##[ ##1: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; - nchange with ( - ((eq_aluHC05 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk HC05 x4 y4)) = - ((eq_aluHC05 y1 x1) ⊗ (forall_memory_ranged t y3 x3 y2 x2 addrl) ⊗ (eq_clk HC05 y4 x4))); - nrewrite > (symmetric_eqaluHC05 x1 y1) - ##| ##2,3: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; - nchange with ( - ((eq_aluHC08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = - ((eq_aluHC08 y1 x1) ⊗ (forall_memory_ranged t y3 x3 y2 x2 addrl) ⊗ (eq_clk ? y4 x4))); - nrewrite > (symmetric_eqaluHC08 x1 y1) - ##| ##4: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; - nchange with ( - ((eq_aluRS08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk RS08 x4 y4)) = - ((eq_aluRS08 y1 x1) ⊗ (forall_memory_ranged t y3 x3 y2 x2 addrl) ⊗ (eq_clk RS08 y4 x4))); - nrewrite > (symmetric_eqaluRS08 x1 y1) - ##] - nrewrite > (symmetric_forallmemoryranged t x3 y3 x2 y2 addrl); - nrewrite > (symmetric_eqclk ? x4 y4); - napply refl_eq. -nqed. - -nlemma eqanystatus_to_eq : -∀addrl:list word16.∀m:mcu_type.∀t:memory_impl.∀s1,s2:any_status m t. - (eq_anystatus m t s1 s2 addrl = true) → - And3 (alu m t s1 = alu m t s2) - (clk_desc m t s1 = clk_desc m t s2) - ((forall_memory_ranged t (chk_desc m t s1) (chk_desc m t s2) - (mem_desc m t s1) (mem_desc m t s2) addrl) = true). - #addrl; #m; #t; - ncases m; #s1; - ##[ ##1: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange in H:(%) with ( - ((eq_aluHC05 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (eqaluHC05_to_eq … (andb_true_true_l … (andb_true_true_l … H))) - ##| ##2,3: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange in H:(%) with ( - ((eq_aluHC08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (eqaluHC08_to_eq … (andb_true_true_l … (andb_true_true_l … H))) - ##| ##4: ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange in H:(%) with ( - ((eq_aluRS08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (eqaluRS08_to_eq … (andb_true_true_l … (andb_true_true_l … H))) - ##] - nchange with (And3 (y1 = y1) (x4 = y4) (forall_memory_ranged t x3 y3 x2 y2 addrl = true)); - nrewrite > (andb_true_true_r … (andb_true_true_l … H)); - nrewrite > (eqclk_to_eq … (andb_true_true_r … H)); - napply (conj3 … (refl_eq ? y1) (refl_eq ? y4) (refl_eq ? true)). -nqed. - -nlemma eq_to_eqanystatus_strong : -∀addrl:list word16.∀m:mcu_type.∀t:memory_impl.∀s1,s2:any_status m t. - s1 = s2 → (eq_anystatus m t s1 s2 addrl = true). - #addrl; #m; #t; - ncases m; - ##[ ##1: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange with ( - ((eq_aluHC05 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (anystatus_destruct_1 … H); - nrewrite > (eq_to_eqaluHC05 y1 y1 (refl_eq …)) - ##| ##2,3: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange with ( - ((eq_aluHC08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (anystatus_destruct_1 … H); - nrewrite > (eq_to_eqaluHC08 y1 y1 (refl_eq …)) - ##| ##4: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; - nchange with ( - ((eq_aluRS08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nrewrite > (anystatus_destruct_1 … H); - nrewrite > (eq_to_eqaluRS08 y1 y1 (refl_eq …)) - ##] - nrewrite > (anystatus_destruct_2 … H); - nrewrite > (anystatus_destruct_3 … H); - nrewrite > (anystatus_destruct_4 … H); - nrewrite > (eq_to_eqclk ? y4 y4 (refl_eq …)); - nchange with ((forall_memory_ranged … ⊗ true) =true); - nrewrite > (symmetric_andbool (forall_memory_ranged t y3 y3 y2 y2 addrl) true); - nchange with ((forall_memory_ranged t y3 y3 y2 y2 ?) = true); - napply (list_ind word16 … addrl); - ##[ ##1,3,5,7: nnormalize; napply refl_eq - ##| ##2,4,6,8: #a; #l'; #H; - nchange with ( - ((eq_option byte8 (mem_read t y2 y3 a) - (mem_read t y2 y3 a) eq_b8) ⊗ - (forall_memory_ranged t y3 y3 y2 y2 l')) = true); - nrewrite > H; - nrewrite > (eq_to_eqoption ? (mem_read t y2 y3 a) (mem_read t y2 y3 a) eq_b8 eq_to_eqb8 (refl_eq …)); - nnormalize; - napply refl_eq - ##] -nqed. - -nlemma eq_to_eqanystatus_weak : -∀addrl:list word16.∀m:mcu_type.∀t:memory_impl.∀s1,s2:any_status m t. - (alu m t s1 = alu m t s2) → - (clk_desc m t s1 = clk_desc m t s2) → - ((forall_memory_ranged t (chk_desc m t s1) (chk_desc m t s2) - (mem_desc m t s1) (mem_desc m t s2) addrl) = true) → - (eq_anystatus m t s1 s2 addrl = true). - #addrl; #m; #t; - ncases m; - ##[ ##1: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; #H1; #H2; - nchange with (((eq_aluHC05 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nchange in H:(%) with (x1 = y1); - nrewrite > H; - nrewrite > (eq_to_eqaluHC05 y1 y1 (refl_eq …)) - ##| ##2,3: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; #H1; #H2; - nchange with (((eq_aluHC08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nchange in H:(%) with (x1 = y1); - nrewrite > H; - nrewrite > (eq_to_eqaluHC08 y1 y1 (refl_eq …)) - ##| ##4: #s1; ncases s1; #x1; #x2; #x3; #x4; - #s2; ncases s2; #y1; #y2; #y3; #y4; #H; #H1; #H2; - nchange with (((eq_aluRS08 x1 y1) ⊗ (forall_memory_ranged t x3 y3 x2 y2 addrl) ⊗ (eq_clk ? x4 y4)) = true); - nchange in H:(%) with (x1 = y1); - nrewrite > H; - nrewrite > (eq_to_eqaluRS08 y1 y1 (refl_eq …)) - ##] - nchange in H2:(%) with (forall_memory_ranged t x3 y3 x2 y2 addrl = true); - nrewrite > H2; - nchange in H1:(%) with (x4 = y4); - nrewrite > H1; - nrewrite > (eq_to_eqclk ? y4 y4 (refl_eq …)); - nnormalize; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/translation.ma b/helm/software/matita/contribs/ng_assembly/freescale/translation.ma deleted file mode 100755 index 099694894..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/translation.ma +++ /dev/null @@ -1,247 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/table_HC05.ma". -include "freescale/table_HC08.ma". -include "freescale/table_HCS08.ma". -include "freescale/table_RS08.ma". -include "common/option.ma". - -(* ***************************** *) -(* TRADUZIONE ESADECIMALE → INFO *) -(* ***************************** *) - -(* accesso alla tabella della ALU prescelta *) -ndefinition opcode_table ≝ -λm:mcu_type. - match m - return λm:mcu_type.list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8) - with - [ HC05 ⇒ opcode_table_HC05 - | HC08 ⇒ opcode_table_HC08 - | HCS08 ⇒ opcode_table_HCS08 - | RS08 ⇒ opcode_table_RS08 - ]. - -(* traduzione mcu+esadecimale → info *) -(* NB: la ricerca per byte non matcha con una word con lo stesso byte superiore uguale *) -(* NB: per matchare una word (precode+code) bisogna passare una word *) -(* NB: il risultato e' sempre un'opzione, NON esiste un dummy opcode tipo UNKNOWN/ILLEGAL *) -nlet rec full_info_of_word16_aux (m:mcu_type) (borw:byte8_or_word16) - (param:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on param ≝ - match param with - [ nil ⇒ None ? - | cons hd tl ⇒ - match thd4T … hd with - [ Byte b ⇒ match borw with - [ Byte borw' ⇒ match eq_b8 borw' b with - [ true ⇒ Some ? hd - | false ⇒ full_info_of_word16_aux m borw tl ] - | Word _ ⇒ full_info_of_word16_aux m borw tl ] - | Word w ⇒ match borw with - [ Byte _ ⇒ full_info_of_word16_aux m borw tl - | Word borw' ⇒ match eq_w16 borw' w with - [ true ⇒ Some ? hd - | false ⇒ full_info_of_word16_aux m borw tl ] - ]]]. - -ndefinition full_info_of_word16 ≝ -λm:mcu_type.λborw:byte8_or_word16. -full_info_of_word16_aux m borw (opcode_table m). - -(* ******************************************************* *) -(* TRADUZIONE MCU+OPCODE+MODALITA'+ARGOMENTI → ESADECIMALE *) -(* ******************************************************* *) - -(* introduzione di un tipo byte8 dipendente dall'mcu_type (phantom type) *) -ninductive t_byte8 (m:mcu_type) : Type ≝ - TByte : byte8 → t_byte8 m. - -ndefinition eq_tbyte8 ≝ -λm.λtb1,tb2:t_byte8 m. - match tb1 with - [ TByte b1 ⇒ match tb2 with - [ TByte b2 ⇒ eq_b8 b1 b2 ]]. - -(* introduzione di un tipo dipendente (dalla modalita') per gli argomenti *) -ninductive MA_check : instr_mode → Type ≝ - maINH : MA_check MODE_INH -| maINHA : MA_check MODE_INHA -| maINHX : MA_check MODE_INHX -| maINHH : MA_check MODE_INHH -| maINHX0ADD : MA_check MODE_INHX0ADD -| maINHX1ADD : byte8 → MA_check MODE_INHX1ADD -| maINHX2ADD : word16 → MA_check MODE_INHX2ADD -| maIMM1 : byte8 → MA_check MODE_IMM1 -| maIMM1EXT : byte8 → MA_check MODE_IMM1EXT -| maIMM2 : word16 → MA_check MODE_IMM2 -| maDIR1 : byte8 → MA_check MODE_DIR1 -| maDIR2 : word16 → MA_check MODE_DIR2 -| maIX0 : MA_check MODE_IX0 -| maIX1 : byte8 → MA_check MODE_IX1 -| maIX2 : word16 → MA_check MODE_IX2 -| maSP1 : byte8 → MA_check MODE_SP1 -| maSP2 : word16 → MA_check MODE_SP2 -| maDIR1_to_DIR1 : byte8 → byte8 → MA_check MODE_DIR1_to_DIR1 -| maIMM1_to_DIR1 : byte8 → byte8 → MA_check MODE_IMM1_to_DIR1 -| maIX0p_to_DIR1 : byte8 → MA_check MODE_IX0p_to_DIR1 -| maDIR1_to_IX0p : byte8 → MA_check MODE_DIR1_to_IX0p -| maINHA_and_IMM1 : byte8 → MA_check MODE_INHA_and_IMM1 -| maINHX_and_IMM1 : byte8 → MA_check MODE_INHX_and_IMM1 -| maIMM1_and_IMM1 : byte8 → byte8 → MA_check MODE_IMM1_and_IMM1 -| maDIR1_and_IMM1 : byte8 → byte8 → MA_check MODE_DIR1_and_IMM1 -| maIX0_and_IMM1 : byte8 → MA_check MODE_IX0_and_IMM1 -| maIX0p_and_IMM1 : byte8 → MA_check MODE_IX0p_and_IMM1 -| maIX1_and_IMM1 : byte8 → byte8 → MA_check MODE_IX1_and_IMM1 -| maIX1p_and_IMM1 : byte8 → byte8 → MA_check MODE_IX1p_and_IMM1 -| maSP1_and_IMM1 : byte8 → byte8 → MA_check MODE_SP1_and_IMM1 -| maDIRn : ∀n.byte8 → MA_check (MODE_DIRn n) -| maDIRn_and_IMM1 : ∀n.byte8 → byte8 → MA_check (MODE_DIRn_and_IMM1 n) -| maTNY : ∀e.MA_check (MODE_TNY e) -| maSRT : ∀t.MA_check (MODE_SRT t) -. - -(* picker: trasforma l'argomento necessario in input a bytes_of_pseudo_instr_mode_param: - MA_check i → list (t_byte8 m) *) -ndefinition args_picker ≝ -λm:mcu_type.λi:instr_mode.λargs:MA_check i. - match args with - (* inherent: legale se nessun operando *) - [ maINH ⇒ nil ? - | maINHA ⇒ nil ? - | maINHX ⇒ nil ? - | maINHH ⇒ nil ? - (* inherent address: legale se nessun operando/1 byte/1 word *) - | maINHX0ADD ⇒ nil ? - | maINHX1ADD b ⇒ [ TByte m b ] - | maINHX2ADD w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] - (* _0/1/2: legale se nessun operando/1 byte/1 word *) - | maIMM1 b ⇒ [ TByte m b ] - | maIMM1EXT b ⇒ [ TByte m b ] - | maIMM2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] - | maDIR1 b ⇒ [ TByte m b ] - | maDIR2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] - | maIX0 ⇒ nil ? - | maIX1 b ⇒ [ TByte m b ] - | maIX2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] - | maSP1 b ⇒ [ TByte m b ] - | maSP2 w ⇒ [ TByte m (w16h w); TByte m (w16l w) ] - (* movimento: legale se 2 operandi byte *) - | maDIR1_to_DIR1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maIMM1_to_DIR1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maIX0p_to_DIR1 b ⇒ [ TByte m b] - | maDIR1_to_IX0p b ⇒ [ TByte m b] - (* cbeq/dbnz: legale se 1/2 operandi byte *) - | maINHA_and_IMM1 b ⇒ [ TByte m b] - | maINHX_and_IMM1 b ⇒ [ TByte m b] - | maIMM1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maDIR1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maIX0_and_IMM1 b ⇒ [ TByte m b] - | maIX0p_and_IMM1 b ⇒ [ TByte m b] - | maIX1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maIX1p_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - | maSP1_and_IMM1 b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - (* DIRn: legale se 1 operando byte *) - | maDIRn _ b ⇒ [ TByte m b] - (* DIRn_and_IMM1: legale se 2 operandi byte *) - | maDIRn_and_IMM1 _ b1 b2 ⇒ [ TByte m b1 ; TByte m b2 ] - (* TNY: legale se nessun operando *) - | maTNY _ ⇒ nil ? - (* SRT: legale se nessun operando *) - | maSRT _ ⇒ nil ? - ]. - -(* trasformatore finale: mcu+opcode+instr_mode+args → list (t_byte8 m) *) -nlet rec bytes_of_pseudo_instr_mode_param_aux (m:mcu_type) (o:any_opcode m) (i:instr_mode) (p:MA_check i) - (param:list (Prod4T (any_opcode m) instr_mode byte8_or_word16 byte8)) on param ≝ - match param with - [ nil ⇒ None ? | cons hd tl ⇒ - match (eq_anyop m o (fst4T … hd)) ⊗ (eq_im i (snd4T … hd)) with - [ true ⇒ match thd4T … hd with - [ Byte isab ⇒ - Some ? ([ (TByte m isab) ]@(args_picker m i p)) - | Word isaw ⇒ - Some ? ([ (TByte m (w16h isaw)) ; (TByte m (w16l isaw)) ]@(args_picker m i p)) - ] - | false ⇒ bytes_of_pseudo_instr_mode_param_aux m o i p tl ]]. - -ndefinition bytes_of_pseudo_instr_mode_param ≝ -λm:mcu_type.λo:any_opcode m.λi:instr_mode.λp:MA_check i. -bytes_of_pseudo_instr_mode_param_aux m o i p (opcode_table m). - -(* ****************************** *) -(* APPROCCIO COMPILAZIONE AL VOLO *) -(* ****************************** *) - -(* ausiliario di compile *) -ndefinition defined_option ≝ - λT:Type.λo:option T. - match o with - [ None ⇒ False - | Some _ ⇒ True - ]. - -(* compila solo se l'intera istruzione+modalita'+argomenti ha riscontro nelle tabelle *) -ndefinition compile ≝ -λmcu:mcu_type.λi:instr_mode.λop:opcode.λarg:MA_check i. - match bytes_of_pseudo_instr_mode_param mcu (anyOP mcu op) i arg - return λres:option ?.defined_option ? res → ? - with - [ None ⇒ λp:defined_option ? (None ?).False_rect_Type0 ? p - | Some x ⇒ λp:defined_option ? (Some ? x).x - ]. - -(* detipatore del compilato: (t_byte8 m) → byte8 *) -nlet rec source_to_byte8_HC05_aux (p1:list (t_byte8 HC05)) (p2:list byte8) ≝ - match p1 with - [ nil ⇒ p2 - | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HC05_aux tl (p2@[b]) ] - ]. - -nlet rec source_to_byte8_HC08_aux (p1:list (t_byte8 HC08)) (p2:list byte8) ≝ - match p1 with - [ nil ⇒ p2 - | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HC08_aux tl (p2@[b]) ] - ]. - -nlet rec source_to_byte8_HCS08_aux (p1:list (t_byte8 HCS08)) (p2:list byte8) ≝ - match p1 with - [ nil ⇒ p2 - | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_HCS08_aux tl (p2@[b]) ] - ]. - -nlet rec source_to_byte8_RS08_aux (p1:list (t_byte8 RS08)) (p2:list byte8) ≝ - match p1 with - [ nil ⇒ p2 - | cons hd tl ⇒ match hd with [ TByte b ⇒ source_to_byte8_RS08_aux tl (p2@[b]) ] - ]. - -ndefinition source_to_byte8 ≝ -λm:mcu_type. - match m - return λm:mcu_type.list (t_byte8 m) → list byte8 - with - [ HC05 ⇒ λl:list (t_byte8 HC05).source_to_byte8_HC05_aux l [] - | HC08 ⇒ λl:list (t_byte8 HC08).source_to_byte8_HC08_aux l [] - | HCS08 ⇒ λl:list (t_byte8 HCS08).source_to_byte8_HCS08_aux l [] - | RS08 ⇒ λl:list (t_byte8 RS08).source_to_byte8_RS08_aux l [] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/freescale/translation_lemmas.ma b/helm/software/matita/contribs/ng_assembly/freescale/translation_lemmas.ma deleted file mode 100755 index 18db2df62..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale/translation_lemmas.ma +++ /dev/null @@ -1,88 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/translation.ma". -include "num/byte8_lemmas.ma". - -(* ******************************************************* *) -(* TRADUZIONE MCU+OPCODE+MODALITA'+ARGOMENTI → ESADECIMALE *) -(* ******************************************************* *) - -nlemma tbyte8_destruct : ∀m,b1,b2.TByte m b1 = TByte m b2 → b1 = b2. - #m; #b1; #b2; #H; - nchange with (match TByte m b2 with [ TByte a ⇒ b1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqtbyte8 : ∀m.∀tb1,tb2:t_byte8 m.eq_tbyte8 m tb1 tb2 = eq_tbyte8 m tb2 tb1. - #m; #tb1; nelim tb1; #b1; #tb2; nelim tb2; #b2; - nchange with ((eq_b8 b1 b2) = (eq_b8 b2 b1)); - napply (symmetric_eqb8 b1 b2). -nqed. - -nlemma eqtbyte8_to_eq : ∀m.∀tb1,tb2:t_byte8 m.eq_tbyte8 m tb1 tb2 = true → tb1 = tb2. - #m; #tb1; nelim tb1; #b1; #tb2; nelim tb2; #b2; - nchange with ((eq_b8 b1 b2 = true) → ?); - #H; - nrewrite > (eqb8_to_eq b1 b2 H); - napply refl_eq. -nqed. - -nlemma eq_to_eqtbyte8 : ∀m.∀tb1,tb2:t_byte8 m.tb1 = tb2 → eq_tbyte8 m tb1 tb2 = true. - #m; #tb1; nelim tb1; #b1; #tb2; nelim tb2; #b2; - nchange with (? → (eq_b8 b1 b2 = true)); - #H; - nrewrite > (tbyte8_destruct m … H); - nrewrite > (eq_to_eqb8 b2 b2 (refl_eq …)); - napply refl_eq. -nqed. - -nlemma decidable_tbyte8 : ∀m.∀x,y:t_byte8 m.decidable (x = y). - #m; #x; nelim x; #e1; #y; nelim y; #e2; - nnormalize; - napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 e1 e2) …); - ##[ ##2: #H; napply (or2_intro2 (? = ?) (? ≠ ?) … ); nnormalize; #H1; napply (H (tbyte8_destruct m … H1)) - ##| ##1: #H; nrewrite > H; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) - ##] -nqed. - -nlemma neqtbyte8_to_neq : ∀m.∀tb1,tb2:t_byte8 m.(eq_tbyte8 m tb1 tb2 = false) → (tb1 ≠ tb2). - #m; #tb1; nelim tb1; #b1; #tb2; nelim tb2; #b2; - nchange with (((eq_b8 b1 b2) = false) → ?); - #H; - nnormalize; - #H1; - napply (neqb8_to_neq … H); - napply (tbyte8_destruct m … H1). -nqed. - -nlemma neq_to_neqtbyte8 : ∀m.∀tb1,tb2:t_byte8 m.tb1 ≠ tb2 → eq_tbyte8 m tb1 tb2 = false. - #m; #tb1; nelim tb1; #b1; #tb2; nelim tb2; #b2; - #H; nchange with ((eq_b8 b1 b2) = false); - napply (neq_to_neqb8 b1 b2 ?); - nnormalize; - #H1; - nrewrite > H1 in H:(%); #H; - napply (H (refl_eq …)). -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests.ma deleted file mode 100755 index 68db649b5..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests.ma +++ /dev/null @@ -1,887 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/medium_tests_tools.ma". -include "common/list_utility.ma". -include "common/nat_to_num.ma". - -(* ************************ *) -(* HCS08GB60 String Reverse *) -(* ************************ *) - -(* versione ridotta, in cui non si riazzerano gli elementi di counters *) -ndefinition dTest_HCS08_sReverse_source : word16 → (list byte8) ≝ -λelems:word16. -let m ≝ HCS08 in source_to_byte8 m ( -(* BEFORE: A=0x00 H:X=0x0D4B SP=0x0D4A PC=0x18E0 Z=true *) - -(* static unsigned char dati[3072]={...}; - - void swap(unsigned char *a, unsigned char *b) - { unsigned char tmp=*a; *a=*b; *b=tmp; return; } *) - -(* [0x18C8] allineamento *) (compile m ? NOP maINH I) @ - -(* argomenti: HX e [0x0D49-A], passaggio ibrido reg, stack *) -(* [0x18C9] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x18CA] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x18CB] LDHX 5,SP *) (compile m ? LDHX (maSP1 〈x0,x5〉) I) @ -(* [0x18CE] LDA ,X *) (compile m ? LDA maIX0 I) @ -(* [0x18CF] LDHX 1,SP *) (compile m ? LDHX (maSP1 〈x0,x1〉) I) @ -(* [0x18D2] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18D3] LDA ,X *) (compile m ? LDA maIX0 I) @ -(* [0x18D4] LDHX 6,SP *) (compile m ? LDHX (maSP1 〈x0,x6〉) I) @ -(* [0x18D7] STA ,X *) (compile m ? STA maIX0 I) @ -(* [0x18D8] LDHX 2,SP *) (compile m ? LDHX (maSP1 〈x0,x2〉) I) @ -(* [0x18DB] PULA *) (compile m ? PULA maINH I) @ -(* [0x18DC] STA ,X *) (compile m ? STA maIX0 I) @ -(* [0x18DD] AIS #2 *) (compile m ? AIS (maIMM1 〈x0,x2〉) I) @ -(* [0x18DF] RTS *) (compile m ? RTS maINH I) @ - -(* void main(void) - { - unsigned int pos=0,limit=0; - - for(limit=3072;pos<(limit/2);pos++) - { swap(&dati[pos],&dati[limit-pos-1]); } *) - -(* [0x18E0] LDHX #elems *) (compile m ? LDHX (maIMM2 elems) I) @ -(* [0x18E3] STHX 4,SP *) (compile m ? STHX (maSP1 〈x0,x4〉) I) @ -(* [0x18E6] BRA *+52 ; 191A *) (compile m ? BRA (maIMM1 〈x3,x2〉) I) @ -(* [0x18E8] TSX *) (compile m ? TSX maINH I) @ -(* [0x18E9] LDA 2,X *) (compile m ? LDA (maIX1 〈x0,x2〉) I) @ -(* [0x18EB] ADD #0x00 *) (compile m ? ADD (maIMM1 〈x0,x0〉) I) @ -(* [0x18ED] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18EE] LDA 1,X *) (compile m ? LDA (maIX1 〈x0,x1〉) I) @ -(* [0x18F0] ADC #0x01 *) (compile m ? ADC (maIMM1 〈x0,x1〉) I) @ -(* [0x18F2] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18F3] LDA 4,X *) (compile m ? LDA (maIX1 〈x0,x4〉) I) @ -(* [0x18F5] SUB 2,X *) (compile m ? SUB (maIX1 〈x0,x2〉) I) @ -(* [0x18F7] STA ,X *) (compile m ? STA maIX0 I) @ -(* [0x18F8] LDA 3,X *) (compile m ? LDA (maIX1 〈x0,x3〉) I) @ -(* [0x18FA] SBC 1,X *) (compile m ? SBC (maIX1 〈x0,x1〉) I) @ -(* [0x18FC] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18FD] LDX ,X *) (compile m ? LDX maIX0 I) @ -(* [0x18FE] PULH *) (compile m ? PULH maINH I) @ -(* [0x18FF] AIX #-1 *) (compile m ? AIX (maIMM1 〈xF,xF〉) I) @ -(* [0x1901] TXA *) (compile m ? TXA maINH I) @ -(* [0x1902] ADD #0x00 *) (compile m ? ADD (maIMM1 〈x0,x0〉) I) @ -(* [0x1904] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1905] TSX *) (compile m ? TSX maINH I) @ -(* [0x1906] STA 3,X *) (compile m ? STA (maIX1 〈x0,x3〉) I) @ -(* [0x1908] PULA *) (compile m ? PULA maINH I) @ -(* [0x1909] ADC #0x01 *) (compile m ? ADC (maIMM1 〈x0,x1〉) I) @ -(* [0x190B] LDX 3,X *) (compile m ? LDX (maIX1 〈x0,x3〉) I) @ -(* [0x190D] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x190E] PULH *) (compile m ? PULH maINH I) @ -(* [0x190F] BSR *-70 ; 18C9 *) (compile m ? BSR (maIMM1 〈xB,x8〉) I) @ -(* [0x1911] AIS #2 *) (compile m ? AIS (maIMM1 〈x0,x2〉) I) @ -(* [0x1913] TSX *) (compile m ? TSX maINH I) @ -(* [0x1914] INC 2,X *) (compile m ? INC (maIX1 〈x0,x2〉) I) @ -(* [0x1916] BNE *+4 ; 191A *) (compile m ? BNE (maIMM1 〈x0,x2〉) I) @ -(* [0x1918] INC 1,X *) (compile m ? INC (maIX1 〈x0,x1〉) I) @ -(* [0x191A] TSX *) (compile m ? TSX maINH I) @ -(* [0x191B] LDA 3,X *) (compile m ? LDA (maIX1 〈x0,x3〉) I) @ -(* [0x191D] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x191E] PULH *) (compile m ? PULH maINH I) @ -(* [0x191F] LSRA *) (compile m ? LSR maINHA I) @ -(* [0x1920] TSX *) (compile m ? TSX maINH I) @ -(* [0x1921] LDX 4,X *) (compile m ? LDX (maIX1 〈x0,x4〉) I) @ -(* [0x1923] RORX *) (compile m ? ROR maINHX I) @ -(* [0x1924] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x1925] PULH *) (compile m ? PULH maINH I) @ -(* [0x1926] CPHX 2,SP *) (compile m ? CPHX (maSP1 〈x0,x2〉) I) @ -(* [0x1929] BHI *-65 ; 18E8 *) (compile m ? BHI (maIMM1 〈xB,xD〉) I) - -(* [0x192B] !FINE! - attraverso simulazione in CodeWarrior si puo' enunciare che dopo - 42+79*n+5*(n>>9) ci sara' il reverse di n byte (PARI) e - H:X=n/2 *) - ). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition dTest_HCS08_sReverse_status ≝ -λt:memory_impl. -λA_op:byte8. -λHX_op:word16. -λelems:word16. -λdata:list byte8. - set_acc_8_low_reg HCS08 t (* A<-A_op *) - (set_z_flag HCS08 t (* Z<-true *) - (setweak_sp_reg HCS08 t (* SP<-0x0D4A *) - (setweak_indX_16_reg HCS08 t (* H:X<-HX_op *) - (set_pc_reg HCS08 t (* PC<-0x18E0 *) - (start_of_mcu_version_HCS08 MC9S08GB60 t - (load_from_source_at t (* carica data in RAM:dTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:dTest_HCS08_prog *) - (dTest_HCS08_sReverse_source elems) dTest_HCS08_prog) - data dTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08GB60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - (mk_word16 (mk_byte8 x1 x8) (mk_byte8 xE x0))) - HX_op) - (mk_word16 (mk_byte8 x0 xD) (mk_byte8 x4 xA))) - true) - A_op. - -(* parametrizzazione dell'enunciato del teorema *) -(* primo sbozzo: confronto esecuzione con hexdump... *) -nlemma dTest_HCS08_sReverse_dump_aux ≝ -λt:memory_impl.λstring:list byte8. - (* 1) la stringa deve avere una lunghezza ∈ [0,3072] *) - (byte8_bounded_strlen string 〈〈x0,xC〉:〈x0,x0〉〉) ∧ - (* 2) la stringa deve avere lunghezza pari *) - ((and_b8 (w16l (byte8_strlen string)) 〈x0,x1〉) = 〈x0,x0〉) ∧ - (* 3) match di esecuzione su tempo in forma di tempo esatto *) - (match execute HCS08 t - (* parametri IN: t,H:X,strlen(string),string *) - (TickOK ? (dTest_HCS08_sReverse_status t 〈x0,x0〉 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen string) string)) - (* tempo di esecuzione 42+79*n+5*(n>>9) *) - (nat42 + (nat79 * (len_list ? string))+(nat5 * ((len_list ? string) / nat512))) with - [ TickERR s _ ⇒ None ? - (* azzeramento tutta RAM tranne dati *) - | TickSUSP s _ ⇒ None ? - | TickOK s ⇒ Some ? (byte8_hexdump t (mem_desc HCS08 t s) dTest_HCS08_RAM (len_list ? string)) - ] = - Some ? (reverse_list ? string)). - -(* confronto esecuzione con hexdump... *) -(* -lemma dTest_HCS08_sReverse_dump : - dTest_HCS08_sReverse_dump_aux MEM_TREE dTest_random_32. - unfold dTest_HCS08_sReverse_dump_aux; - split; - [ split; [ normalize in ⊢ (%); autobatch ] reflexivity ] - reflexivity. -qed. -*) - -(* parametrizzazione dell'enunciato del teorema *) -(* dimostrazione senza svolgimento degli stati *) -nlemma dTest_HCS08_sReverse_aux ≝ -λt:memory_impl.λstring:list byte8. - (* 1) la stringa deve avere una lunghezza ∈ [0,3072] *) - (byte8_bounded_strlen string 〈〈x0,xC〉:〈x0,x0〉〉) ∧ - (* 2) la stringa deve avere lunghezza pari *) - ((and_b8 (w16l (byte8_strlen string)) 〈x0,x1〉) = 〈x0,x0〉) ∧ - (* 3) match di esecuzione su tempo in forma di tempo esatto *) - (match execute HCS08 t - (* parametri IN: t,H:X,strlen(string),string *) - (TickOK ? (dTest_HCS08_sReverse_status t 〈x0,x0〉 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen string) string)) - (* tempo di esecuzione 42+79*n+5*(n>>9) *) - (nat42 + (nat79 * (len_list ? string))+(nat5 * ((len_list ? string) / nat512))) with - [ TickERR s _ ⇒ None ? - (* azzeramento tutta RAM tranne dati *) - | TickSUSP s _ ⇒ None ? - | TickOK s ⇒ Some ? (set_mem_desc HCS08 t s (load_from_source_at t (mem_desc HCS08 t s) dTest_zeros 〈〈x0,xD〉:〈x0,x0〉〉)) - ] = - Some ? (set_pc_reg HCS08 t - (dTest_HCS08_sReverse_status t (fst … (shr_b8 (w16h (byte8_strlen string)))) (fst … (shr_w16 (byte8_strlen string))) (byte8_strlen string) (reverse_list ? string)) - (mk_word16 (mk_byte8 x1 x9) (mk_byte8 x2 xB)))). - -(* -lemma dTest_HCS08_sReverse : - dTest_HCS08_sReverse_aux MEM_TREE dTest_random_32. - unfold dTest_HCS08_sReverse_aux; - split; - [ split; [ normalize in ⊢ (%); autobatch ] reflexivity ] - - rewrite > (breakpoint HCS08 MEM_TREE (TickOK ? (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32)) 3 (39+79*byte8_strlen dTest_random_32+5*(byte8_strlen dTest_random_32/512))) in ⊢ (? ? match % in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?); - letin status0 ≝ (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32); - change in ⊢ (? ? match ? ? ? (? ? ? % ?) ? in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?) with - (TickOK ? status0); - rewrite > (execute_HCS08_LDHX_maIMM2 MEM_TREE status0 〈x0,x0〉 〈x2,x0〉) in ⊢ (? ? match ? ? ? % ? in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?); - [ 2,3,4,5: reflexivity; ] - - letin status1 ≝ (set_pc_reg HCS08 MEM_TREE (setweak_v_flag HCS08 MEM_TREE (setweak_n_flag HCS08 MEM_TREE (set_z_flag HCS08 MEM_TREE (set_alu HCS08 MEM_TREE (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32) (set_indX_16_reg_HC08 (alu HCS08 MEM_TREE (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32)) 〈〈x0,x0〉:〈x2,x0〉〉)) (eq_w16 〈〈x0,x0〉:〈x2,x0〉〉 〈〈x0,x0〉:〈x0,x0〉〉)) (MSB_w16 〈〈x0,x0〉:〈x2,x0〉〉)) false) (filtered_plus_w16 HCS08 MEM_TREE (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32) (get_pc_reg HCS08 MEM_TREE (dTest_HCS08_sReverse_status MEM_TREE 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen dTest_random_32) dTest_random_32)) 3)); - change in ⊢ (? ? match ? ? ? % ? in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?) with (TickOK ? status1); - - rewrite > (breakpoint HCS08 MEM_TREE (TickOK ? status1) 5 (34+79*byte8_strlen dTest_random_32+5*(byte8_strlen dTest_random_32/512))) in ⊢ (? ? match % in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?); - change in ⊢ (? ? match ? ? ? (? ? ? % ?) ? in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?) with (TickOK ? status1); - rewrite > (execute_HCS08_STHX_maSP1 status1 〈x0,x4〉) - in ⊢ (? ? match ? ? ? % ? in tick_result return ? with [TickERR⇒?|TickSUSP⇒?|TickOK⇒?] ?); - [ 2,3,4,5,6,7: reflexivity; ] - - elim daemon. - -qed. -*) - -ndefinition sReverseCalc ≝ -λstring:list byte8. - match execute HCS08 MEM_TREE - (TickOK ? (dTest_HCS08_sReverse_status MEM_TREE 〈x0,x0〉 〈〈x0,xD〉:〈x4,xB〉〉 (byte8_strlen string) string)) - (nat42 + (nat79 * (len_list ? string))+(nat5 * ((len_list ? string) / nat512))) with - [ TickERR s _ ⇒ None ? - | TickSUSP s _ ⇒ None ? - | TickOK s ⇒ Some ? (set_mem_desc HCS08 MEM_TREE s (load_from_source_at MEM_TREE (mem_desc HCS08 MEM_TREE s) dTest_zeros 〈〈x0,xD〉:〈x0,x0〉〉)) - ]. - -ndefinition sReverseNoCalc ≝ -λstring:list byte8. - Some ? (set_pc_reg HCS08 MEM_TREE - (dTest_HCS08_sReverse_status MEM_TREE (fst … (shr_b8 (w16h (byte8_strlen string)))) - (fst … (shr_w16 (byte8_strlen string))) - (byte8_strlen string) (reverse_list ? string)) - (mk_word16 (mk_byte8 x1 x9) (mk_byte8 x2 xB))). - -ndefinition sReverseCalc32 ≝ sReverseCalc dTest_random_32. -ndefinition sReverseCalc64 ≝ sReverseCalc dTest_random_64. -ndefinition sReverseCalc128 ≝ sReverseCalc dTest_random_128. -ndefinition sReverseCalc256 ≝ sReverseCalc dTest_random_256. -ndefinition sReverseCalc512 ≝ sReverseCalc dTest_random_512. -ndefinition sReverseCalc1024 ≝ sReverseCalc dTest_random_1024. -ndefinition sReverseCalc2048 ≝ sReverseCalc dTest_random_2048. -ndefinition sReverseCalc3072 ≝ sReverseCalc dTest_random_3072. - -ndefinition sReverseNoCalc32 ≝ sReverseNoCalc dTest_random_32. -ndefinition sReverseNoCalc64 ≝ sReverseNoCalc dTest_random_64. -ndefinition sReverseNoCalc128 ≝ sReverseNoCalc dTest_random_128. -ndefinition sReverseNoCalc256 ≝ sReverseNoCalc dTest_random_256. -ndefinition sReverseNoCalc512 ≝ sReverseNoCalc dTest_random_512. -ndefinition sReverseNoCalc1024 ≝ sReverseNoCalc dTest_random_1024. -ndefinition sReverseNoCalc2048 ≝ sReverseNoCalc dTest_random_2048. -ndefinition sReverseNoCalc3072 ≝ sReverseNoCalc dTest_random_3072. - -(* *********************** *) -(* HCS08GB60 Counting Sort *) -(* *********************** *) - -(* versione ridotta, in cui non si riazzerano gli elementi di counters *) -ndefinition dTest_HCS08_cSort_source : word16 → (list byte8) ≝ -λelems:word16. -let m ≝ HCS08 in source_to_byte8 m ( -(* BEFORE: A=0x00 H:X=0x0F4C SP=0x0F4B PC=0x18C8 Z=true *) - -(* /* IPOTESI: INIT VARIABILI+ARRAY GIA' ESEGUITO */ - static unsigned int counters[256]={ campitura di 0 }; - static unsigned char dati[3072]={ dati random }; - - void CountingSort(void) - { - unsigned int index=0,position=0; *) - -(* /* TESI: CODICE DA ESEGUIRE - - /* calcolo del # ripetizioni degli elementi byte */ - for(;index<3072;index++) - { counters[dati[index]]++; } *) - -(* [0x18C8] BRA *+31;18E7 *) (compile m ? BRA (maIMM1 〈x1,xD〉) I) @ -(* [0x18CA] LDHX 1,SP *) (compile m ? LDHX (maSP1 〈x0,x1〉) I) @ -(* [0x18CD] LDA 256,X *) (compile m ? LDA (maIX2 〈〈x0,x1〉:〈x0,x0〉〉) I) @ -(* [0x18D0] LSLA *) (compile m ? ASL maINHA I) @ -(* [0x18D1] CLRX *) (compile m ? CLR maINHX I) @ -(* [0x18D2] ROLX *) (compile m ? ROL maINHX I) @ -(* [0x18D3] ADD #0x00 *) (compile m ? ADD (maIMM1 〈x0,x0〉) I) @ -(* [0x18D5] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18D6] TXA *) (compile m ? TXA maINH I) @ -(* [0x18D7] ADC #0x0D *) (compile m ? ADC (maIMM1 〈x0,xD〉) I) @ -(* [0x18D9] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x18DA] PULH *) (compile m ? PULH maINH I) @ -(* [0x18DB] PULX *) (compile m ? PULX maINH I) @ -(* [0x18DC] INC 1,X *) (compile m ? INC (maIX1 〈x0,x1〉) I) @ -(* [0x18DE] BNE *+3 *) (compile m ? BNE (maIMM1 〈x0,x1〉) I) @ -(* [0x18E0] INC ,X *) (compile m ? INC maIX0 I) @ -(* [0x18E1] TSX *) (compile m ? TSX maINH I) @ -(* [0x18E2] INC 1,X *) (compile m ? INC (maIX1 〈x0,x1〉) I) @ -(* [0x18E4] BNE *+3 *) (compile m ? BNE (maIMM1 〈x0,x1〉) I) @ -(* [0x18E6] INC ,X *) (compile m ? INC maIX0 I) @ -(* [0x18E7] LDHX 1,SP *) (compile m ? LDHX (maSP1 〈x0,x1〉) I) @ -(* [0x18EA] CPHX #elems *) (compile m ? CPHX (maIMM2 elems) I) @ (* dimensione dei dati al massimo 0x0C00 *) -(* [0x18ED] BCS *-35;18CA *) (compile m ? BCS (maIMM1 〈xD,xB〉) I) @ - -(* /* sovrascrittura di dati per produrre la versione ordinata */ - for(index=0;index<256;index++) - { - while(counters[index]--) - { dati[position++]=index; } - } *) - -(* [0x18EF] TSX *) (compile m ? TSX maINH I) @ -(* [0x18F0] CLR 1,X *) (compile m ? CLR (maIX1 〈x0,x1〉) I) @ -(* [0x18F2] CLR ,X *) (compile m ? CLR maIX0 I) @ -(* [0x18F3] BRA *+16 *) (compile m ? BRA (maIMM1 〈x0,xE〉) I) @ -(* [0x18F5] TSX *) (compile m ? TSX maINH I) @ -(* [0x18F6] LDA 1,X *) (compile m ? LDA (maIX1 〈x0,x1〉) I) @ -(* [0x18F8] LDHX 3,SP *) (compile m ? LDHX (maSP1 〈x0,x3〉) I) @ -(* [0x18FB] STA 256,X *) (compile m ? STA (maIX2 〈〈x0,x1〉:〈x0,x0〉〉) I) @ -(* [0x18FE] AIX #1 *) (compile m ? AIX (maIMM1 〈x0,x1〉) I) @ -(* [0x1900] STHX 3,SP *) (compile m ? STHX (maSP1 〈x0,x3〉) I) @ -(* [0x1903] TSX *) (compile m ? TSX maINH I) @ -(* [0x1904] LDX 1,X *) (compile m ? LDX (maIX1 〈x0,x1〉) I) @ -(* [0x1906] LSLX *) (compile m ? ASL maINHX I) @ -(* [0x1907] LDA 1,SP *) (compile m ? LDA (maSP1 〈x0,x1〉) I) @ -(* [0x190A] ROLA *) (compile m ? ROL maINHA I) @ -(* [0x190B] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x190C] PULH *) (compile m ? PULH maINH I) @ -(* [0x190D] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x190E] LDHX 3328,X *) (compile m ? LDHX (maIX2 〈〈x0,xD〉:〈x0,x0〉〉) I) @ -(* [0x1912] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x1913] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1914] AIX #-1 *) (compile m ? AIX (maIMM1 〈xF,xF〉) I) @ -(* [0x1916] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1917] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x1918] PULH *) (compile m ? PULH maINH I) @ -(* [0x1919] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x191A] LDX 5,SP *) (compile m ? LDX (maSP1 〈x0,x5〉) I) @ -(* [0x191D] PULA *) (compile m ? PULA maINH I) @ -(* [0x191E] STA 3329,X *) (compile m ? STA (maIX2 〈〈x0,xD〉:〈x0,x1〉〉) I) @ -(* [0x1921] PULA *) (compile m ? PULA maINH I) @ -(* [0x1922] STA 3328,X *) (compile m ? STA (maIX2 〈〈x0,xD〉:〈x0,x0〉〉) I) @ -(* [0x1925] PULH *) (compile m ? PULH maINH I) @ -(* [0x1926] PULX *) (compile m ? PULX maINH I) @ -(* [0x1927] CPHX #0x0000 *) (compile m ? CPHX (maIMM2 〈〈x0,x0〉:〈x0,x0〉〉) I) @ -(* [0x192A] PULH *) (compile m ? PULH maINH I) @ -(* [0x192B] BNE *-54 *) (compile m ? BNE (maIMM1 〈xC,x8〉) I) @ -(* [0x192D] TSX *) (compile m ? TSX maINH I) @ -(* [0x192E] INC 1,X *) (compile m ? INC (maIX1 〈x0,x1〉) I) @ -(* [0x1930] BNE *+3 *) (compile m ? BNE (maIMM1 〈x0,x1〉) I) @ -(* [0x1932] INC ,X *) (compile m ? INC maIX0 I) @ -(* [0x1933] LDHX 1,SP *) (compile m ? LDHX (maSP1 〈x0,x1〉) I) @ -(* [0x1936] CPHX #0x0100 *) (compile m ? CPHX (maIMM2 〈〈x0,x1〉:〈x0,x0〉〉) I) @ -(* [0x1939] BNE *-54 *) (compile m ? BNE (maIMM1 〈xC,x8〉) I) @ -(* [0x193B] STOP *) (compile m ? STOP maINH I) - -(* [0x193C] !FINE! - attraverso simulazione in CodeWarrior si puo' enunciare che dopo - 25700+150n si sara' entrati in stato STOP corrispondente con ordinamento - di n byte, A=0xFF H:X=0x0100 *) - ). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition dTest_HCS08_cSort_status ≝ -λt:memory_impl. -λI_op:bool. -λA_op:byte8. -λHX_op:word16. -λelems:word16. -λdata:list byte8. - setweak_i_flag HCS08 t (* I<-I_op *) - (set_acc_8_low_reg HCS08 t (* A<-A_op *) - (set_z_flag HCS08 t (* Z<-true *) - (setweak_sp_reg HCS08 t (* SP<-0x0F4B *) - (setweak_indX_16_reg HCS08 t (* H:X<-HX_op *) - (set_pc_reg HCS08 t (* PC<-dTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08GB60 t - (load_from_source_at t (* carica data in RAM:dTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:dTest_HCS08_prog *) - (dTest_HCS08_cSort_source elems) dTest_HCS08_prog) - data dTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08GB60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - dTest_HCS08_prog) - HX_op) - (mk_word16 (mk_byte8 x0 xF) (mk_byte8 x4 xB))) - true) - A_op) - I_op. - -(* parametrizzazione dell'enunciato del teorema parziale *) -nlemma dTest_HCS08_cSort_aux ≝ -λt:memory_impl.λstring:list byte8. - (* 1) la stringa deve avere una lunghezza ∈ [0,3072] *) - (byte8_bounded_strlen string 〈〈x0,xC〉:〈x0,x0〉〉) ∧ - (* 2) match di esecuzione su tempo in forma di upperbound *) - (match execute HCS08 t - (* parametri IN: t,A,H:X,strlen(string),string *) - (TickOK ? (dTest_HCS08_cSort_status t true 〈x0,x0〉 〈〈x0,xF〉:〈x4,xC〉〉 (byte8_strlen string) string)) - (* tempo di esecuzione 25700+150*n *) - (((nat256 + nat1) * nat100)+((nat50 * nat3) * (len_list ? string))) with - [ TickERR s _ ⇒ None ? - (* azzeramento tutta RAM tranne dati *) - | TickSUSP s _ ⇒ Some ? (set_mem_desc HCS08 t s (load_from_source_at t (mem_desc HCS08 t s) dTest_zeros 〈〈x0,xD〉:〈x0,x0〉〉)) - | TickOK s ⇒ None ? - ] = - Some ? (set_pc_reg HCS08 t - (dTest_HCS08_cSort_status t false 〈xF,xF〉 〈〈x0,x1〉:〈x0,x0〉〉 (byte8_strlen string) (byte8_list_ordering string)) - (mk_word16 (mk_byte8 x1 x9) (mk_byte8 x3 xC)))). - -(* dimostrazione senza svolgimento degli stati *) -(* -lemma dTest_HCS08_cSort : - dTest_HCS08_cSort_aux MEM_TREE dTest_random_32. - unfold dTest_HCS08_cSort_aux; - split; - [ normalize in ⊢ (%); autobatch ] - reflexivity. -qed. -*) - -ndefinition cSortCalc ≝ -λstring:list byte8. - match execute HCS08 MEM_TREE - (TickOK ? (dTest_HCS08_cSort_status MEM_TREE true 〈x0,x0〉 〈〈x0,xF〉:〈x4,xC〉〉 (byte8_strlen string) string)) - (((nat256 + nat1) * nat100)+((nat50 * nat3) * (len_list ? string))) with - [ TickERR s _ ⇒ None ? - | TickSUSP s _ ⇒ Some ? (set_mem_desc HCS08 MEM_TREE s (load_from_source_at MEM_TREE (mem_desc HCS08 MEM_TREE s) dTest_zeros 〈〈x0,xD〉:〈x0,x0〉〉)) - | TickOK s ⇒ None ? - ]. - -ndefinition cSortNoCalc ≝ -λstring:list byte8. - Some ? (set_pc_reg HCS08 MEM_TREE - (dTest_HCS08_cSort_status MEM_TREE false 〈xF,xF〉 〈〈x0,x1〉:〈x0,x0〉〉 (byte8_strlen string) (byte8_list_ordering string)) - (mk_word16 (mk_byte8 x1 x9) (mk_byte8 x3 xC))). - -ndefinition cSortCalc32 ≝ cSortCalc dTest_random_32. -ndefinition cSortCalc64 ≝ cSortCalc dTest_random_64. -ndefinition cSortCalc128 ≝ cSortCalc dTest_random_128. -ndefinition cSortCalc256 ≝ cSortCalc dTest_random_256. -ndefinition cSortCalc512 ≝ cSortCalc dTest_random_512. -ndefinition cSortCalc1024 ≝ cSortCalc dTest_random_1024. -ndefinition cSortCalc2048 ≝ cSortCalc dTest_random_2048. -ndefinition cSortCalc3072 ≝ cSortCalc dTest_random_3072. - -ndefinition cSortNoCalc32 ≝ cSortNoCalc dTest_random_32. -ndefinition cSortNoCalc64 ≝ cSortNoCalc dTest_random_64. -ndefinition cSortNoCalc128 ≝ cSortNoCalc dTest_random_128. -ndefinition cSortNoCalc256 ≝ cSortNoCalc dTest_random_256. -ndefinition cSortNoCalc512 ≝ cSortNoCalc dTest_random_512. -ndefinition cSortNoCalc1024 ≝ cSortNoCalc dTest_random_1024. -ndefinition cSortNoCalc2048 ≝ cSortNoCalc dTest_random_2048. -ndefinition cSortNoCalc3072 ≝ cSortNoCalc dTest_random_3072. - -(* ********************** *) -(* HCS08GB60 numeri aurei *) -(* ********************** *) - -(* versione ridotta, in cui non si riazzerano gli elementi di counters *) -ndefinition dTest_HCS08_gNum_source : word16 → (list byte8) ≝ -λelems:word16. -let m ≝ HCS08 in source_to_byte8 m ( -(* BEFORE: A=0x00 HX=0x1A00 PC=0x18BE SP=0x016F Z=1 (I=1) *) - -(* -static unsigned int result[16]={ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -word result[16] = 0x0100 - -void goldenNumbers(void) -{ -unsigned int res_pos=0,tested_num=0,divisor=0; -unsigned long int acc=0; -*) - -(* [0x18BE] AIS #-10 *) (compile m ? AIS (maIMM1 〈xF,x6〉) I) @ -(* [0x18C0] TSX *) (compile m ? TSX maINH I) @ -(* [0x18C1] CLR 9,x *) (compile m ? CLR (maIX1 〈x0,x9〉) I) @ -(* [0x18C3] CLR 8,X *) (compile m ? CLR (maIX1 〈x0,x8〉) I) @ -(* [0x18C5] CLR 1,X *) (compile m ? CLR (maIX1 〈x0,x1〉) I) @ -(* [0x18C7] CLR ,X *) (compile m ? CLR maIX0 I) @ -(* [0x18C8] CLR 3,X *) (compile m ? CLR (maIX1 〈x0,x3〉) I) @ -(* [0x18CA] CLR 2,X *) (compile m ? CLR (maIX1 〈x0,x2〉) I) @ -(* [0x18CC] JSR 0x1951 *) (compile m ? JSR (maIMM2 〈〈x1,x9〉:〈x5,x1〉〉) I) @ - -(* -for(tested_num=1;tested_num<2;tested_num++) - { -*) - -(* [0x18CF] STHX 1,SP *) (compile m ? STHX (maSP1 〈x0,x1〉) I) @ -(* [0x18D2] BRA *+116 ; 0x1946 *) (compile m ? BRA (maIMM1 〈x7,x2〉) I) @ -(* [0x18D4] BSR *+125 ; 0x1951 *) (compile m ? BSR (maIMM1 〈x7,xB〉) I) @ -(* [0x18D6] STHX 3,SP *) (compile m ? STHX (maSP1 〈x0,x3〉) I) @ - -(* - for(acc=0,divisor=1;divisor1951 !FINE! *) (compile m ? STOP maINH I) @ -(* [0x1951] CLRX *) (compile m ? CLR maINHX I) @ -(* [0x1952] CLRH *) (compile m ? CLR maINHH I) @ -(* [0x1953] STHX 9,SP *) (compile m ? STHX (maSP1 〈x0,x9〉) I) @ -(* [0x1956] CLRH *) (compile m ? CLR maINHH I) @ -(* [0x1957] STHX 7,SP *) (compile m ? STHX (maSP1 〈x0,x7〉) I) @ -(* [0x195A] INCX *) (compile m ? INC maINHX I) @ -(* [0x195B] RTS *) (compile m ? RTS maINH I) @ - -(* -static void _PUSH_ARGS_L(void) { ... } -*) - -(* [0x195C] LDA 3,X *) (compile m ? LDA (maIX1 〈x0,x3〉) I) @ -(* [0x195E] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x195F] LDA 2,X *) (compile m ? LDA (maIX1 〈x0,x2〉) I) @ -(* [0x1961] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x1962] LDHX ,X *) (compile m ? LDHX maIX0 I) @ -(* [0x1964] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x1965] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1966] LDHX 7,SP *) (compile m ? LDHX (maSP1 〈x0,x7〉) I) @ -(* [0x1969] LDA 3,X *) (compile m ? LDA (maIX1 〈x0,x3〉) I) @ -(* [0x196B] STA 17,SP *) (compile m ? STA (maSP1 〈x1,x1〉) I) @ -(* [0x196E] LDA 2,X *) (compile m ? LDA (maIX1 〈x0,x2〉) I) @ -(* [0x1970] STA 16,SP *) (compile m ? STA (maSP1 〈x1,x0〉) I) @ -(* [0x1973] LDHX ,X *) (compile m ? LDHX maIX0 I) @ -(* [0x1975] STHX 14,SP *) (compile m ? STHX (maSP1 〈x0,xE〉) I) @ -(* [0x1978] LDHX 5,SP *) (compile m ? LDHX (maSP1 〈x0,x5〉) I) @ -(* [0x197B] JMP ,X *) (compile m ? JMP maINHX0ADD I) @ - -(* -static void _ENTER_BINARY_L(void) { ... } -*) - -(* [0x197C] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x197D] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x197E] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x197F] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x1980] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1981] LDHX 6,SP *) (compile m ? LDHX (maSP1 〈x0,x6〉) I) @ -(* [0x1984] PSHX *) (compile m ? PSHX maINH I) @ -(* [0x1985] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x1986] LDHX 10,SP *) (compile m ? LDHX (maSP1 〈x0,xA〉) I) @ -(* [0x1989] STHX 8,SP *) (compile m ? STHX (maSP1 〈x0,x8〉) I) @ -(* [0x198C] LDHX 12,SP *) (compile m ? LDHX (maSP1 〈x0,xC〉) I) @ -(* [0x198F] JMP 0x195C *) (compile m ? JMP (maIMM2 〈〈x1,x9〉:〈x5,xC〉〉) I) @ - -(* -static void _IDIVMOD (char dummy_sgn, int j, int dummy, int i, ...) { ... } -*) - -(* [0x1992] TST 4,SP *) (compile m ? TST (maSP1 〈x0,x4〉) I) @ -(* [0x1995] BNE *+28 ; 0x19B1 *) (compile m ? BNE (maIMM1 〈x1,xA〉) I) @ -(* [0x1997] TSX *) (compile m ? TSX maINH I) @ -(* [0x1998] LDA 7,X *) (compile m ? LDA (maIX1 〈x0,x7〉) I) @ -(* [0x199A] LDX 4,X *) (compile m ? LDX (maIX1 〈x0,x4〉) I) @ -(* [0x199C] CLRH *) (compile m ? CLR maINHH I) @ -(* [0x199D] DIV *) (compile m ? DIV maINH I) @ -(* [0x199E] STA 4,SP *) (compile m ? STA (maSP1 〈x0,x4〉) I) @ -(* [0x19A1] LDA 9,SP *) (compile m ? LDA (maSP1 〈x0,x9〉) I) @ -(* [0x19A4] DIV *) (compile m ? DIV maINH I) @ -(* [0x19A5] STA 5,SP *) (compile m ? STA (maSP1 〈x0,x5〉) I) @ -(* [0x19A8] CLR 8,SP *) (compile m ? CLR (maSP1 〈x0,x8〉) I) @ -(* [0x19AB] PSHH *) (compile m ? PSHH maINH I) @ -(* [0x19AC] PULA *) (compile m ? PULA maINH I) @ -(* [0x19AD] STA 9,SP *) (compile m ? STA (maSP1 〈x0,x9〉) I) @ -(* [0x19B0] RTS *) (compile m ? RTS maINH I) @ -(* [0x19B1] CLRA *) (compile m ? CLR maINHA I) @ -(* [0x19B2] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x19B3] LDX #0x08 *) (compile m ? LDX (maIMM1 〈x0,x8〉) I) @ -(* [0x19B5] CLC *) (compile m ? CLC maINH I) @ -(* [0x19B6] ROL 10,SP *) (compile m ? ROL (maSP1 〈x0,xA〉) I) @ -(* [0x19B9] ROL 9,SP *) (compile m ? ROL (maSP1 〈x0,x9〉) I) @ -(* [0x19BC] ROL 1,SP *) (compile m ? ROL (maSP1 〈x0,x1〉) I) @ -(* [0x19BF] LDA 5,SP *) (compile m ? LDA (maSP1 〈x0,x5〉) I) @ -(* [0x19C2] CMP 1,SP *) (compile m ? CMP (maSP1 〈x0,x1〉) I) @ -(* [0x19C5] BHI *+31 ; 0x19E4 *) (compile m ? BHI (maIMM1 〈x1,xD〉) I) @ -(* [0x19C7] BNE *+10 ; 0x19D1 *) (compile m ? BNE (maIMM1 〈x0,x8〉) I) @ -(* [0x19C9] LDA 6,SP *) (compile m ? LDA (maSP1 〈x0,x6〉) I) @ -(* [0x19CC] CMP 9,SP *) (compile m ? CMP (maSP1 〈x0,x9〉) I) @ -(* [0x19CF] BHI *+21 ; 0x19E4 *) (compile m ? BHI (maIMM1 〈x1,x3〉) I) @ -(* [0x19D1] LDA 9,SP *) (compile m ? LDA (maSP1 〈x0,x9〉) I) @ -(* [0x19D4] SUB 6,SP *) (compile m ? SUB (maSP1 〈x0,x6〉) I) @ -(* [0x19D7] STA 9,SP *) (compile m ? STA (maSP1 〈x0,x9〉) I) @ -(* [0x19DA] LDA 1,SP *) (compile m ? LDA (maSP1 〈x0,x1〉) I) @ -(* [0x19DD] SBC 5,SP *) (compile m ? SBC (maSP1 〈x0,x5〉) I) @ -(* [0x19E0] STA 1,SP *) (compile m ? STA (maSP1 〈x0,x1〉) I) @ -(* [0x19E3] SEC *) (compile m ? SEC maINH I) @ -(* [0x19E4] DBNZX *-46 ; 0x19B6 *) (compile m ? DBNZ (maINHX_and_IMM1 〈xD,x0〉) I) @ -(* [0x19E6] LDA 10,SP *) (compile m ? LDA (maSP1 〈x0,xA〉) I) @ -(* [0x19E9] ROLA *) (compile m ? ROL maINHA I) @ -(* [0x19EA] STA 6,SP *) (compile m ? STA (maSP1 〈x0,x6〉) I) @ -(* [0x19ED] LDA 9,SP *) (compile m ? LDA (maSP1 〈x0,x9〉) I) @ -(* [0x19F0] STA 10,SP *) (compile m ? STA (maSP1 〈x0,xA〉) I) @ -(* [0x19F3] PULA *) (compile m ? PULA maINH I) @ -(* [0x19F4] STA 8,SP *) (compile m ? STA (maSP1 〈x0,x8〉) I) @ -(* [0x19F7] CLR 4,SP *) (compile m ? CLR (maSP1 〈x0,x4〉) I) @ -(* [0x19FA] RTS *) (compile m ? RTS maINH I) @ - -(* -static void _LADD_k_is_k_plus_j(_PARAM_BINARY_L) { ... } -*) - -(* [0x19FB] TSX *) (compile m ? TSX maINH I) @ -(* [0x19FC] LDA 18,X *) (compile m ? LDA (maIX1 〈x1,x2〉) I) @ -(* [0x19FE] ADD 5,X *) (compile m ? ADD (maIX1 〈x0,x5〉) I) @ -(* [0x1A00] STA 18,X *) (compile m ? STA (maIX1 〈x1,x2〉) I) @ -(* [0x1A02] LDA 17,X *) (compile m ? LDA (maIX1 〈x1,x1〉) I) @ -(* [0x1A04] ADC 4,X *) (compile m ? ADC (maIX1 〈x0,x4〉) I) @ -(* [0x1A06] STA 17,X *) (compile m ? STA (maIX1 〈x1,x1〉) I) @ -(* [0x1A08] LDA 16,X *) (compile m ? LDA (maIX1 〈x1,x0〉) I) @ -(* [0x1A0A] ADC 3,X *) (compile m ? ADC (maIX1 〈x0,x3〉) I) @ -(* [0x1A0C] STA 16,X *) (compile m ? STA (maIX1 〈x1,x0〉) I) @ -(* [0x1A0E] LDA 15,X *) (compile m ? LDA (maIX1 〈x0,xF〉) I) @ -(* [0x1A10] ADC 2,X *) (compile m ? ADC (maIX1 〈x0,x2〉) I) @ -(* [0x1A12] STA 15,X *) (compile m ? STA (maIX1 〈x0,xF〉) I) @ -(* [0x1A14] AIS #10 *) (compile m ? AIS (maIMM1 〈x0,xA〉) I) @ -(* [0x1A16] PULH *) (compile m ? PULH maINH I) @ -(* [0x1A17] PULX *) (compile m ? PULX maINH I) @ -(* [0x1A18] PULA *) (compile m ? PULA maINH I) @ -(* [0x1A19] RTS *) (compile m ? RTS maINH I) @ - -(* -void _IMODU_STAR08(int i, ...) { ... } -*) - -(* [0x1A1A] AIS #-2 *) (compile m ? AIS (maIMM1 〈xF,xE〉) I) @ -(* [0x1A1C] STHX 1,SP *) (compile m ? STHX (maSP1 〈x0,x1〉) I) @ -(* [0x1A1F] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x1A20] JSR 0x1992 *) (compile m ? JSR (maIMM2 〈〈x1,x9〉:〈x9,x2〉〉) I) @ -(* [0x1A23] PULA *) (compile m ? PULA maINH I) @ -(* [0x1A24] AIS #2 *) (compile m ? AIS (maIMM1 〈x0,x2〉) I) @ -(* [0x1A26] LDHX 3,SP *) (compile m ? LDHX (maSP1 〈x0,x3〉) I) @ -(* [0x1A29] RTS *) (compile m ? RTS maINH I) @ - -(* -void _LADD(void) { ... } -*) - -(* [0x1A2A] JSR 0x197C *) (compile m ? JSR (maIMM2 〈〈x1,x9〉:〈x7,xC〉〉) I) @ -(* [0x1A2D] JSR 0x19FB *) (compile m ? JSR (maIMM2 〈〈x1,x9〉:〈xF,xB〉〉) I) @ - -(* -void _POP32(void) { ... } -*) - -(* [0x1A30] PSHA *) (compile m ? PSHA maINH I) @ -(* [0x1A31] LDA 4,SP *) (compile m ? LDA (maSP1 〈x0,x4〉) I) @ -(* [0x1A34] STA ,X *) (compile m ? STA maIX0 I) @ -(* [0x1A35] LDA 5,SP *) (compile m ? LDA (maSP1 〈x0,x5〉) I) @ -(* [0x1A38] STA 1,X *) (compile m ? STA (maIX1 〈x0,x1〉) I) @ -(* [0x1A3A] LDA 6,SP *) (compile m ? LDA (maSP1 〈x0,x6〉) I) @ -(* [0x1A3D] STA 2,X *) (compile m ? STA (maIX1 〈x0,x2〉) I) @ -(* [0x1A3F] LDA 7,SP *) (compile m ? LDA (maSP1 〈x0,x7〉) I) @ -(* [0x1A42] STA 3,X *) (compile m ? STA (maIX1 〈x0,x3〉) I) @ -(* [0x1A44] PULA *) (compile m ? PULA maINH I) @ -(* [0x1A45] PULH *) (compile m ? PULH maINH I) @ -(* [0x1A46] PULX *) (compile m ? PULX maINH I) @ -(* [0x1A47] AIS #4 *) (compile m ? AIS (maIMM1 〈x0,x4〉) I) @ -(* [0x1A49] JMP ,X *) (compile m ? JMP maINHX0ADD I) - -(* attraverso simulazione in CodeWarrior si puo' enunciare che dopo - 80+(65*n*(n+1)*(n+2))/6 si sara' entrati in stato STOP corrispondente - AFTER: HX=num PC=0x1951 I=0 *) - ). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition dTest_HCS08_gNum_status ≝ -λt:memory_impl. -λI_op:bool. -λA_op:byte8. -λHX_op:word16. -λPC_op:word16. -λaddr:word16. -λelems:word16. -λdata:list byte8. - setweak_i_flag HCS08 t (* I<-I_op *) - (set_acc_8_low_reg HCS08 t (* A<-A_op *) - (set_z_flag HCS08 t (* Z<-true *) - (setweak_sp_reg HCS08 t (* SP<-0x016F *) - (setweak_indX_16_reg HCS08 t (* H:X<-HX_op *) - (set_pc_reg HCS08 t (* PC<-PC_op *) - (start_of_mcu_version_HCS08 - MC9S08GB60 t - (load_from_source_at t (* carica data in RAM:dTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:addr *) - (dTest_HCS08_cSort_source elems) addr) - data dTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08GB60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - PC_op) - HX_op) - (mk_word16 (mk_byte8 x0 x1) (mk_byte8 x6 xF))) - true) - A_op) - I_op. - -(* NUMERI AUREI: Somma divisori(x)=x, fino a 0xFFFF sono 6/28/496/8128 *) -ndefinition dTest_HCS08_gNum_aurei ≝ -λnum:word16.match gt_w16 num 〈〈x1,xF〉:〈xC,x0〉〉 with - [ true ⇒ [ 〈x0,x0〉 ; 〈x0,x6〉 ; 〈x0,x0〉 ; 〈x1,xC〉 ; 〈x0,x1〉 ; 〈xF,x0〉 ; 〈x1,xF〉 ; 〈xC,x0〉 ] - | false ⇒ match gt_w16 num 〈〈x0,x1〉:〈xF,x0〉〉 with - [ true ⇒ [ 〈x0,x0〉 ; 〈x0,x6〉 ; 〈x0,x0〉 ; 〈x1,xC〉 ; 〈x0,x1〉 ; 〈xF,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ] - | false ⇒ match gt_w16 num 〈〈x0,x0〉:〈x1,xC〉〉 with - [ true ⇒ [ 〈x0,x0〉 ; 〈x0,x6〉 ; 〈x0,x0〉 ; 〈x1,xC〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ] - | false ⇒ match gt_w16 num 〈〈x0,x0〉:〈x0,x6〉〉 with - [ true ⇒ [ 〈x0,x0〉 ; 〈x0,x6〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ] - | false ⇒ [ 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ] - ] - ] - ] - ] @ [ 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 - ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 - ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ; 〈x0,x0〉 ]. - -(* esecuzione execute k*(n+2) *) -nlet rec dTest_HCS08_gNum_execute1 (m:mcu_type) (t:memory_impl) (s:tick_result (any_status m t)) (n,ntot:nat) on n ≝ - match s with - [ TickERR s' error ⇒ TickERR ? s' error - | TickSUSP s' susp ⇒ TickSUSP ? s' susp - | TickOK s' ⇒ match n with - [ O ⇒ TickOK ? s' - | S n' ⇒ dTest_HCS08_gNum_execute1 m t (execute m t (TickOK ? s') (ntot + nat2)) n' ntot ] - ]. - -(* esecuzione execute k*(n+1)*(n+2) *) -nlet rec dTest_HCS08_gNum_execute2 (m:mcu_type) (t:memory_impl) (s:tick_result (any_status m t)) (n,ntot:nat) on n ≝ - match s with - [ TickERR s' error ⇒ TickERR ? s' error - | TickSUSP s' susp ⇒ TickSUSP ? s' susp - | TickOK s' ⇒ match n with - [ O ⇒ TickOK ? s' - | S n' ⇒ dTest_HCS08_gNum_execute2 m t (dTest_HCS08_gNum_execute1 m t (TickOK ? s') (ntot + nat1) ntot) n' ntot ] - ]. - -(* esecuzione execute k*n*(n+1)*(n+2) *) -nlet rec dTest_HCS08_gNum_execute3 (m:mcu_type) (t:memory_impl) (s:tick_result (any_status m t)) (n,ntot:nat) on n ≝ - match s with - [ TickERR s' error ⇒ TickERR ? s' error - | TickSUSP s' susp ⇒ TickSUSP ? s' susp - | TickOK s' ⇒ match n with - [ O ⇒ TickOK ? s' - | S n' ⇒ dTest_HCS08_gNum_execute3 m t (dTest_HCS08_gNum_execute2 m t (TickOK ? s') ntot ntot) n' ntot ] - ]. - -(* esecuzione execute 80+11*n*(n+1)*(n+2) *) -ndefinition dTest_HCS08_gNum_execute4 ≝ -λm:mcu_type.λt:memory_impl.λs:tick_result (any_status m t).λntot:nat. - match s with - [ TickERR s' error ⇒ TickERR ? s' error - | TickSUSP s' susp ⇒ TickSUSP ? s' susp - | TickOK s' ⇒ execute m t (dTest_HCS08_gNum_execute3 m t (TickOK ? s') nat11 ntot) nat80 - ]. - -(* parametrizzazione dell'enunciato del teorema parziale *) -nlemma dTest_HCS08_gNum_aux ≝ -λt:memory_impl.λnum:word16. - (* 2) match di esecuzione su tempo in forma di upperbound *) - match dTest_HCS08_gNum_execute4 HCS08 t - (TickOK ? (dTest_HCS08_gNum_status t true 〈x0,x0〉 〈〈x1,xA〉:〈x0,x0〉〉 〈〈x1,x8〉:〈xB,xE〉〉 〈〈x1,x8〉:〈xB,xE〉〉 num dTest_zeros)) - (* tempo di esecuzione 80+11*n*(n+1)*(n+2) *) - (nat_of_w16 num) with - [ TickERR s _ ⇒ None ? - (* azzeramento tutta RAM tranne dati *) - | TickSUSP s _ ⇒ Some ? (set_mem_desc HCS08 t s (load_from_source_at t (mem_desc HCS08 t s) dTest_zeros3K 〈〈x0,x1〉:〈x2,x0〉〉)) - | TickOK s ⇒ None ? - ] = - Some ? (dTest_HCS08_gNum_status t false 〈x0,x0〉 num 〈〈x1,x9〉:〈x5,x1〉〉 〈〈x1,x8〉:〈xB,xE〉〉 num (dTest_HCS08_gNum_aurei num)). - -ndefinition gNumCalc ≝ -λnum:word16. - match dTest_HCS08_gNum_execute4 HCS08 MEM_TREE - (TickOK ? (dTest_HCS08_gNum_status MEM_TREE true 〈x0,x0〉 〈〈x1,xA〉:〈x0,x0〉〉 〈〈x1,x8〉:〈xB,xE〉〉 〈〈x1,x8〉:〈xB,xE〉〉 num dTest_zeros)) - (nat_of_w16 num) with - [ TickERR s _ ⇒ None ? - | TickSUSP s _ ⇒ Some ? (set_mem_desc HCS08 MEM_TREE s (load_from_source_at MEM_TREE (mem_desc HCS08 MEM_TREE s) dTest_zeros3K 〈〈x0,x1〉:〈x2,x0〉〉)) - | TickOK s ⇒ None ? - ]. - -ndefinition gNumNoCalc ≝ -λnum:word16. - Some ? (dTest_HCS08_gNum_status MEM_TREE false 〈x0,x0〉 num 〈〈x1,x9〉:〈x5,x1〉〉 〈〈x1,x8〉:〈xB,xE〉〉 num (dTest_HCS08_gNum_aurei num)). - -ndefinition gNumCalc1 ≝ gNumCalc 〈〈x0,x0〉:〈x0,x1〉〉. -ndefinition gNumCalc2 ≝ gNumCalc 〈〈x0,x0〉:〈x0,x2〉〉. -ndefinition gNumCalc5 ≝ gNumCalc 〈〈x0,x0〉:〈x0,x5〉〉. -ndefinition gNumCalc10 ≝ gNumCalc 〈〈x0,x0〉:〈x0,xA〉〉. -ndefinition gNumCalc20 ≝ gNumCalc 〈〈x0,x0〉:〈x1,x4〉〉. -ndefinition gNumCalc50 ≝ gNumCalc 〈〈x0,x0〉:〈x3,x2〉〉. -ndefinition gNumCalc100 ≝ gNumCalc 〈〈x0,x0〉:〈x6,x4〉〉. -ndefinition gNumCalc250 ≝ gNumCalc 〈〈x0,x0〉:〈xF,xA〉〉. -ndefinition gNumCalc500 ≝ gNumCalc 〈〈x0,x1〉:〈xF,x4〉〉. -ndefinition gNumCalc1000 ≝ gNumCalc 〈〈x0,x3〉:〈xE,x8〉〉. - -ndefinition gNumNoCalc1 ≝ gNumNoCalc 〈〈x0,x0〉:〈x0,x1〉〉. -ndefinition gNumNoCalc2 ≝ gNumNoCalc 〈〈x0,x0〉:〈x0,x2〉〉. -ndefinition gNumNoCalc5 ≝ gNumNoCalc 〈〈x0,x0〉:〈x0,x5〉〉. -ndefinition gNumNoCalc10 ≝ gNumNoCalc 〈〈x0,x0〉:〈x0,xA〉〉. -ndefinition gNumNoCalc20 ≝ gNumNoCalc 〈〈x0,x0〉:〈x1,x4〉〉. -ndefinition gNumNoCalc50 ≝ gNumNoCalc 〈〈x0,x0〉:〈x3,x2〉〉. -ndefinition gNumNoCalc100 ≝ gNumNoCalc 〈〈x0,x0〉:〈x6,x4〉〉. -ndefinition gNumNoCalc250 ≝ gNumNoCalc 〈〈x0,x0〉:〈xF,xA〉〉. -ndefinition gNumNoCalc500 ≝ gNumNoCalc 〈〈x0,x1〉:〈xF,x4〉〉. -ndefinition gNumNoCalc1000 ≝ gNumNoCalc 〈〈x0,x3〉:〈xE,x8〉〉. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests_tools.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests_tools.ma deleted file mode 100755 index da5987908..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/medium_tests_tools.ma +++ /dev/null @@ -1,592 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale/multivm.ma". - -(* ********* *) -(* INDIRIZZI *) -(* ********* *) - -(* specifico per MC9S08GB60 in modo da caricare codice compilato da CodeWarrior *) -(* l'obbiettivo e' dimostrare una routine scritta in C *) -(* passo 1 e' formalizzare l'uso di 3Kb dei 4Kb di RAM [0x0100-0x0CFF] *) -ndefinition dTest_HCS08_RAM ≝ 〈〈x0,x1〉:〈x0,x0〉〉. -ndefinition dTest_HCS08_prog ≝ 〈〈x1,x8〉:〈xC,x8〉〉. - -(* ***** *) -(* TOOLS *) -(* ***** *) - -(* visita di un albero da 256B di elementi: ln16(256)=2 passaggi *) -ndefinition dTest_visit ≝ -λdata:Array16T (Array16T (list byte8)).λaddr:byte8. - getn_array16T (b8l addr) ? - (getn_array16T (b8h addr) ? data). - -(* scrittura di un elemento in un albero da 256B *) -ndefinition dTest_update ≝ -λdata:Array16T (Array16T (list byte8)).λaddr:byte8.λv:list byte8. - let lev2 ≝ getn_array16T (b8h addr) ? data in - setn_array16T (b8h addr) ? data - (setn_array16T (b8l addr) ? lev2 v) . - -(* array a 0 *) -ndefinition dTest_zero_array ≝ -let elem ≝ nil byte8 in -let lev2 ≝ array_16T ? - elem elem elem elem elem elem elem elem - elem elem elem elem elem elem elem elem - in -let lev1 ≝ array_16T ? - lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 - lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 - in -lev1. - -(* incrementa n-simo elemento *) -ndefinition dTest_inc ≝ -λdata:Array16T (Array16T (list byte8)).λaddr:byte8. - dTest_update data addr ((dTest_visit data addr)@[ addr ]). - -(* costruisce una lista a partire dai conteggi per elemento *) -ndefinition dTest_build_list_from_count ≝ -λdata:Array16T (Array16T (list byte8)). - let aux1 ≝ λparam1:Array16T (list byte8). - match param1 with - [ array_16T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 ⇒ - e00@e01@e02@e03@e04@e05@e06@e07@e08@e09@e10@e11@e12@e13@e14@e15 ] in - let aux2 ≝ λparam2:Array16T (Array16T (list byte8)). - match param2 with - [ array_16T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 ⇒ - (aux1 e00)@(aux1 e01)@(aux1 e02)@(aux1 e03)@(aux1 e04)@(aux1 e05)@(aux1 e06)@(aux1 e07)@ - (aux1 e08)@(aux1 e09)@(aux1 e10)@(aux1 e11)@(aux1 e12)@(aux1 e13)@(aux1 e14)@(aux1 e15) ] in - aux2 data. - -(* ci sono ora tutti gli elementi per definire l'ordinamento *) -(* di una lista di byte8 secondo il counting sort *) -nlet rec byte8_list_ordering_aux (source:list byte8) (count:Array16T (Array16T (list byte8))) on source ≝ - match source with - [ nil ⇒ dTest_build_list_from_count count - | cons hd tl ⇒ byte8_list_ordering_aux tl (dTest_inc count hd) - ]. - -ndefinition byte8_list_ordering ≝ -λsource:list byte8.byte8_list_ordering_aux source dTest_zero_array. - -(* strlen esadecimale limitato, considerando overflow! *) -nlet rec byte8_bounded_strlen_aux (source:list byte8) (count,limit:word16) on source ≝ - match source with - [ nil ⇒ True - | cons _ tl ⇒ match eq_w16 count 〈〈xF,xF〉:〈xF,xF〉〉 with - [ true ⇒ False - | false ⇒ match le_w16 (succ_w16 count) limit with - [ true ⇒ byte8_bounded_strlen_aux tl (succ_w16 count) limit - | false ⇒ False - ] - ] - ]. - -ndefinition byte8_bounded_strlen ≝ -λsource:list byte8.λlimit:word16. - byte8_bounded_strlen_aux source 〈〈x0,x0〉:〈x0,x0〉〉 limit. - -(* strlen esadecimale normale *) -nlet rec byte8_strlen_aux (source:list byte8) (count:word16) on source ≝ - match source with - [ nil ⇒ count - | cons _ tl ⇒ byte8_strlen_aux tl (succ_w16 count) - ]. - -ndefinition byte8_strlen ≝ -λsource:list byte8. - byte8_strlen_aux source 〈〈x0,x0〉:〈x0,x0〉〉. - -(* hex dump: memory -> list byte8 *) -nlet rec byte8_hexdump_aux (t:memory_impl) (mem:aux_mem_type t) (inf:word16) (count:nat) (out:list byte8) on count ≝ - match count with - [ O ⇒ out - | S n ⇒ byte8_hexdump_aux t mem (succ_w16 inf) n (out@[ mem_read_abs t mem inf ]) - ]. - -ndefinition byte8_hexdump ≝ -λt:memory_impl.λmem:aux_mem_type t.λinf:word16.λcount:nat. - byte8_hexdump_aux t mem inf count []. - -(* ************* *) -(* TEST PATTERNS *) -(* ************* *) - -(* lista di 3072 numeri random generati da Mathematica, in blocchi da 32 *) -ndefinition dTest_random_ex00 ≝ -[〈x8,x1〉;〈x5,xE〉;〈x7,x6〉;〈xD,x1〉;〈x7,x5〉;〈x1,x0〉;〈x8,x5〉;〈x9,x0〉;〈x1,xF〉;〈x1,x2〉;〈xE,x2〉;〈x3,xC〉;〈x1,xD〉;〈x0,x6〉;〈x3,xC〉;〈xD,x1〉 -;〈x8,x3〉;〈xE,xB〉;〈x7,x2〉;〈x1,xF〉;〈x9,x0〉;〈xF,x0〉;〈x4,x7〉;〈xA,x3〉;〈xD,x0〉;〈x4,x6〉;〈xC,x5〉;〈x3,x2〉;〈xC,x9〉;〈x0,xB〉;〈x1,xB〉;〈x7,x3〉 ]. - -ndefinition dTest_random_ex01 ≝ -[〈x1,x1〉;〈xA,xF〉;〈xD,x2〉;〈xB,xF〉;〈x0,xB〉;〈xB,xC〉;〈x0,x8〉;〈xE,x5〉;〈xF,xE〉;〈xA,xC〉;〈xF,xC〉;〈x9,x4〉;〈x3,x4〉;〈x8,x8〉;〈x2,x8〉;〈xD,xB〉 -;〈xD,x3〉;〈x3,xD〉;〈x3,x8〉;〈x6,xA〉;〈x4,xD〉;〈x7,x4〉;〈x4,x9〉;〈x7,xE〉;〈x6,xF〉;〈x4,xD〉;〈x3,xD〉;〈x3,xA〉;〈xC,x2〉;〈xD,x3〉;〈x3,x6〉;〈x7,x0〉 ]. - -ndefinition dTest_random_ex02 ≝ -[〈x8,x0〉;〈xC,x9〉;〈x3,xB〉;〈x5,x2〉;〈x8,xF〉;〈x1,xE〉;〈x8,x4〉;〈x5,x2〉;〈x2,xD〉;〈xA,xF〉;〈x1,xB〉;〈x0,x1〉;〈x3,x5〉;〈x7,x2〉;〈x1,x0〉;〈x0,x7〉 -;〈x5,xD〉;〈xA,xB〉;〈xE,x0〉;〈x7,x6〉;〈xB,xD〉;〈x3,xC〉;〈x0,xD〉;〈xC,xE〉;〈xB,x7〉;〈x9,xD〉;〈xA,x9〉;〈xF,x3〉;〈xC,x1〉;〈x9,x3〉;〈x8,xC〉;〈x4,xE〉 ]. - -ndefinition dTest_random_ex03 ≝ -[〈xF,x8〉;〈xC,x3〉;〈x1,x3〉;〈x3,xA〉;〈xA,x2〉;〈xB,xD〉;〈x1,x0〉;〈x9,xB〉;〈x5,xC〉;〈xC,x8〉;〈xE,x5〉;〈xC,x8〉;〈xA,x6〉;〈xF,xB〉;〈x1,x3〉;〈xC,x8〉 -;〈x6,x4〉;〈x0,x9〉;〈xD,x6〉;〈xD,x7〉;〈x3,x9〉;〈xF,x9〉;〈xE,x4〉;〈x0,x3〉;〈x4,x9〉;〈xC,xE〉;〈x7,x1〉;〈x5,x7〉;〈x3,x4〉;〈x2,xE〉;〈xA,x3〉;〈x5,x3〉 ]. - -ndefinition dTest_random_ex04 ≝ -[〈xF,x9〉;〈x2,xA〉;〈xF,x0〉;〈xE,x1〉;〈x6,x6〉;〈x8,x9〉;〈x2,xE〉;〈x8,x6〉;〈xC,x7〉;〈x2,xD〉;〈x1,x2〉;〈xD,x5〉;〈x4,xA〉;〈x7,x9〉;〈x6,xD〉;〈x1,xB〉 -;〈x4,x1〉;〈x9,x4〉;〈x6,xC〉;〈x6,xD〉;〈xF,x4〉;〈x5,xD〉;〈x8,xB〉;〈xB,xE〉;〈xC,x8〉;〈xE,x5〉;〈xA,x4〉;〈xB,xA〉;〈xB,x1〉;〈x2,x1〉;〈x5,x0〉;〈x6,xB〉 ]. - -ndefinition dTest_random_ex05 ≝ -[〈x9,x5〉;〈x0,x6〉;〈x4,x5〉;〈xE,x0〉;〈x0,xF〉;〈x5,xA〉;〈xC,xE〉;〈xC,x8〉;〈x8,x2〉;〈x4,xF〉;〈xC,x2〉;〈xF,x5〉;〈xF,x8〉;〈x1,x3〉;〈xD,xA〉;〈x2,xB〉 -;〈x7,x9〉;〈xB,xF〉;〈xA,x4〉;〈x5,xA〉;〈xD,x2〉;〈x7,x6〉;〈x8,xD〉;〈x1,xF〉;〈x1,x5〉;〈x5,xA〉;〈xD,xE〉;〈x2,x3〉;〈x9,xD〉;〈x7,xE〉;〈x6,x7〉;〈x6,x3〉 ]. - -ndefinition dTest_random_ex06 ≝ -[〈x1,x1〉;〈xF,x5〉;〈x2,x4〉;〈xD,x6〉;〈x6,xA〉;〈x0,xC〉;〈x7,xF〉;〈x1,x2〉;〈xD,x6〉;〈xE,xE〉;〈xB,xA〉;〈x4,x4〉;〈x3,x9〉;〈x9,x2〉;〈x6,x6〉;〈xE,xA〉 -;〈x2,x3〉;〈x4,x4〉;〈xC,xF〉;〈x7,x4〉;〈x6,xB〉;〈x8,x3〉;〈x7,x7〉;〈x0,x4〉;〈x6,x4〉;〈xB,x3〉;〈x3,xC〉;〈x2,x6〉;〈xF,xC〉;〈xD,x5〉;〈x4,x1〉;〈xB,x7〉 ]. - -ndefinition dTest_random_ex07 ≝ -[〈x2,x4〉;〈xE,x0〉;〈xB,x4〉;〈x1,x3〉;〈x3,x2〉;〈x4,x5〉;〈x1,x8〉;〈xD,xB〉;〈x0,x0〉;〈xB,x6〉;〈x5,xF〉;〈x3,xA〉;〈xB,x7〉;〈x4,xF〉;〈xB,x4〉;〈xD,xF〉 -;〈xF,x4〉;〈x1,xA〉;〈x1,x0〉;〈xE,x9〉;〈xC,x5〉;〈x2,xC〉;〈xB,xC〉;〈x5,xB〉;〈x0,x5〉;〈x4,xA〉;〈x5,x2〉;〈xC,x0〉;〈x1,xF〉;〈x5,x9〉;〈xF,x2〉;〈xE,x5〉 ]. - -ndefinition dTest_random_ex08 ≝ -[〈x9,x7〉;〈x5,x1〉;〈xF,x7〉;〈x3,xC〉;〈x7,x7〉;〈x8,x1〉;〈x7,xC〉;〈xB,x0〉;〈x1,xD〉;〈x1,xA〉;〈x7,xB〉;〈x4,x7〉;〈x7,x9〉;〈xC,x2〉;〈x3,xF〉;〈xD,x3〉 -;〈xB,x6〉;〈xD,x7〉;〈xC,x9〉;〈x9,x2〉;〈x0,xD〉;〈x7,xF〉;〈x0,xB〉;〈x7,x5〉;〈x0,xE〉;〈x5,x1〉;〈x9,xF〉;〈x4,xC〉;〈xE,x5〉;〈xD,x0〉;〈xC,x1〉;〈x3,x9〉 ]. - -ndefinition dTest_random_ex09 ≝ -[〈x7,xF〉;〈xE,xA〉;〈x4,x1〉;〈x0,x5〉;〈x0,x8〉;〈x7,xE〉;〈x7,x6〉;〈x2,xF〉;〈x6,x2〉;〈x7,x1〉;〈xF,x8〉;〈x3,x8〉;〈xB,x6〉;〈x7,x0〉;〈xD,xD〉;〈xD,x0〉 -;〈xA,xD〉;〈x7,x8〉;〈x3,xD〉;〈x7,xB〉;〈xC,xC〉;〈x6,xD〉;〈x3,xF〉;〈xA,xC〉;〈xC,x7〉;〈x6,xE〉;〈xF,xF〉;〈x4,x5〉;〈xC,x1〉;〈x7,x4〉;〈xB,xF〉;〈x2,x9〉 ]. - -ndefinition dTest_random_ex0A ≝ -[〈x4,x9〉;〈xC,x5〉;〈x7,xC〉;〈x2,xD〉;〈xF,x2〉;〈xC,xC〉;〈xF,xA〉;〈x5,x8〉;〈xA,xC〉;〈x5,x8〉;〈x5,x1〉;〈x0,xE〉;〈x4,x8〉;〈x7,x0〉;〈x4,x1〉;〈xE,xD〉 -;〈x9,x5〉;〈xB,x4〉;〈x4,x7〉;〈xF,x1〉;〈x8,x1〉;〈xE,x4〉;〈x4,x0〉;〈x5,x4〉;〈x7,xB〉;〈xA,x1〉;〈xD,x2〉;〈x0,x2〉;〈xC,x5〉;〈x7,xD〉;〈x7,xA〉;〈xF,x1〉 ]. - -ndefinition dTest_random_ex0B ≝ -[〈x0,x0〉;〈x8,xD〉;〈x6,x6〉;〈xB,x0〉;〈xA,x9〉;〈x7,xA〉;〈x2,xB〉;〈x2,xC〉;〈x6,xF〉;〈x5,xF〉;〈x6,xF〉;〈x4,xE〉;〈x2,xB〉;〈x1,x1〉;〈xF,xF〉;〈x4,x7〉 -;〈x7,xF〉;〈xC,xF〉;〈xD,x3〉;〈x8,x5〉;〈xB,x8〉;〈x4,xD〉;〈x9,x9〉;〈x8,x3〉;〈x7,x6〉;〈xE,x8〉;〈x3,x0〉;〈xF,x8〉;〈xD,x0〉;〈x5,x9〉;〈xB,x8〉;〈x7,x1〉 ]. - -ndefinition dTest_random_ex0C ≝ -[〈x5,x7〉;〈xA,xF〉;〈xB,x5〉;〈xD,x5〉;〈xF,xC〉;〈x8,x2〉;〈x1,x6〉;〈x1,x0〉;〈xB,x3〉;〈xC,x1〉;〈x1,xA〉;〈x0,x1〉;〈x1,x1〉;〈xF,xF〉;〈x5,x9〉;〈x2,x4〉 -;〈xC,x5〉;〈x7,x2〉;〈xD,x8〉;〈xD,x0〉;〈xA,xD〉;〈xF,xE〉;〈xD,x7〉;〈x1,x1〉;〈xC,xE〉;〈xF,x9〉;〈xB,x8〉;〈x7,x7〉;〈x3,xA〉;〈x1,xF〉;〈x6,x1〉;〈x1,xB〉 ]. - -ndefinition dTest_random_ex0D ≝ -[〈xB,xB〉;〈x5,x5〉;〈x8,x0〉;〈x7,xC〉;〈x2,x5〉;〈x3,x4〉;〈x8,x9〉;〈xF,x2〉;〈xC,x9〉;〈xD,xF〉;〈x3,x5〉;〈xC,x5〉;〈x1,x2〉;〈xF,x0〉;〈x0,x5〉;〈xD,xE〉 -;〈x2,x6〉;〈x4,x9〉;〈xB,x7〉;〈x3,x9〉;〈x0,x5〉;〈xC,x2〉;〈xD,xB〉;〈xF,xC〉;〈x9,xF〉;〈xA,x9〉;〈x6,x6〉;〈xA,xD〉;〈x4,xA〉;〈x3,xF〉;〈xB,xF〉;〈x6,xD〉 ]. - -ndefinition dTest_random_ex0E ≝ -[〈x8,x7〉;〈x6,xA〉;〈xB,x1〉;〈x3,xE〉;〈xB,x6〉;〈x0,xE〉;〈x7,xA〉;〈x3,xB〉;〈x4,x5〉;〈xE,x9〉;〈xC,xE〉;〈x6,xA〉;〈x6,xA〉;〈x7,x0〉;〈x6,x0〉;〈x6,xA〉 -;〈x2,xC〉;〈xD,x2〉;〈xB,x8〉;〈x3,x6〉;〈x2,x1〉;〈x0,x0〉;〈x5,x4〉;〈x3,x1〉;〈x6,x0〉;〈x1,xB〉;〈x4,xC〉;〈xC,xA〉;〈xB,xE〉;〈x5,xF〉;〈x8,x1〉;〈xB,x7〉 ]. - -ndefinition dTest_random_ex0F ≝ -[〈x9,xB〉;〈x2,x6〉;〈x9,x4〉;〈x2,xB〉;〈x4,x1〉;〈x2,xB〉;〈x9,x8〉;〈x6,x3〉;〈x6,x6〉;〈x6,x5〉;〈x4,x6〉;〈x2,x3〉;〈xE,x5〉;〈x0,x7〉;〈x9,xE〉;〈x1,xC〉 -;〈x3,x8〉;〈x5,xC〉;〈x9,x7〉;〈x6,x3〉;〈x5,x3〉;〈x6,x6〉;〈x0,x8〉;〈x5,xD〉;〈x0,x8〉;〈xD,xB〉;〈x6,xE〉;〈x5,x6〉;〈x7,x0〉;〈x3,x2〉;〈x4,x5〉;〈x0,x2〉 ]. - -ndefinition dTest_random_ex10 ≝ -[〈x6,x3〉;〈x7,x2〉;〈x9,xC〉;〈xD,x9〉;〈x5,x0〉;〈x0,x6〉;〈x5,x9〉;〈x1,x7〉;〈x6,x8〉;〈xD,x2〉;〈xD,x7〉;〈x8,xE〉;〈x6,x9〉;〈x5,xF〉;〈x8,x1〉;〈x8,x4〉 -;〈x8,x7〉;〈xD,xC〉;〈x9,x8〉;〈xE,x5〉;〈xB,x5〉;〈xC,x3〉;〈x2,x5〉;〈x6,xC〉;〈x9,x2〉;〈xD,xD〉;〈x2,xA〉;〈xD,x1〉;〈x1,x4〉;〈x7,xE〉;〈x1,x7〉;〈xB,x2〉 ]. - -ndefinition dTest_random_ex11 ≝ -[〈x9,x8〉;〈x5,x5〉;〈xF,xC〉;〈x3,xD〉;〈x8,xD〉;〈xE,xF〉;〈x8,x1〉;〈xB,x8〉;〈xB,xB〉;〈x5,x1〉;〈x0,x0〉;〈xB,x4〉;〈x2,xE〉;〈x3,x0〉;〈x6,x0〉;〈x7,xE〉 -;〈x9,x0〉;〈xE,x3〉;〈xF,x4〉;〈x7,x2〉;〈x1,xC〉;〈xB,x3〉;〈x7,x8〉;〈x1,xB〉;〈x9,xF〉;〈x1,xB〉;〈x0,x3〉;〈xA,x3〉;〈x0,x5〉;〈xD,xE〉;〈x3,x8〉;〈xB,xA〉 ]. - -ndefinition dTest_random_ex12 ≝ -[〈x0,xE〉;〈xE,xD〉;〈xE,xC〉;〈x1,xF〉;〈x3,x8〉;〈xE,x3〉;〈xF,x7〉;〈xA,xA〉;〈xE,x9〉;〈x3,xD〉;〈xF,xF〉;〈xF,x3〉;〈x1,x4〉;〈x2,xC〉;〈x8,x8〉;〈x6,x1〉 -;〈x3,x0〉;〈xA,xB〉;〈x1,x8〉;〈xD,xC〉;〈xF,xE〉;〈x6,xA〉;〈x2,x9〉;〈xF,x1〉;〈xC,xB〉;〈x9,x0〉;〈x7,x8〉;〈x9,x9〉;〈x1,xF〉;〈x2,x8〉;〈xF,x9〉;〈xC,xB〉 ]. - -ndefinition dTest_random_ex13 ≝ -[〈x1,x4〉;〈x8,x4〉;〈xF,x3〉;〈xD,x6〉;〈x7,xE〉;〈xE,xC〉;〈x5,x6〉;〈xC,xE〉;〈xD,xA〉;〈x5,xE〉;〈x6,x1〉;〈xF,x1〉;〈x6,x6〉;〈x6,x9〉;〈x9,x3〉;〈x5,x9〉 -;〈x3,xC〉;〈x1,xD〉;〈x6,xB〉;〈xF,x4〉;〈x5,x9〉;〈x4,xD〉;〈x3,x8〉;〈xA,x9〉;〈x3,xB〉;〈x7,xF〉;〈xB,x2〉;〈xE,xC〉;〈xA,xE〉;〈xF,x6〉;〈xB,x2〉;〈x2,x2〉 ]. - -ndefinition dTest_random_ex14 ≝ -[〈x6,x4〉;〈x2,x7〉;〈x6,xC〉;〈x2,x0〉;〈xE,xE〉;〈x5,x1〉;〈x3,xE〉;〈x8,x8〉;〈xD,xD〉;〈xC,x1〉;〈xD,xC〉;〈xC,x1〉;〈x6,x6〉;〈x6,x1〉;〈x4,x2〉;〈x7,x7〉 -;〈x3,x6〉;〈x0,x8〉;〈x2,x9〉;〈x6,x0〉;〈xA,x9〉;〈xF,xC〉;〈x7,xC〉;〈xA,x7〉;〈xB,x4〉;〈xF,xC〉;〈x8,x7〉;〈x1,xD〉;〈x6,xC〉;〈xA,x2〉;〈x3,xF〉;〈x1,xD〉 ]. - -ndefinition dTest_random_ex15 ≝ -[〈x1,x7〉;〈x0,xF〉;〈x0,x2〉;〈x2,x6〉;〈xA,x2〉;〈x6,xA〉;〈x5,xC〉;〈xE,xD〉;〈x2,x7〉;〈xC,x5〉;〈x7,xB〉;〈xF,x5〉;〈x9,xC〉;〈x8,x5〉;〈x6,x3〉;〈x5,x6〉 -;〈xC,x3〉;〈x4,xB〉;〈x1,xB〉;〈xA,x0〉;〈x1,xB〉;〈x8,x9〉;〈x3,x5〉;〈xD,x6〉;〈xD,x9〉;〈xD,xD〉;〈x2,xE〉;〈x6,x2〉;〈x7,x5〉;〈xE,x7〉;〈x1,x8〉;〈x4,xD〉 ]. - -ndefinition dTest_random_ex16 ≝ -[〈xD,x7〉;〈x5,x8〉;〈xA,x7〉;〈x5,xF〉;〈x9,x4〉;〈x8,x7〉;〈xA,x8〉;〈xE,x7〉;〈x2,xB〉;〈xF,x2〉;〈xE,x7〉;〈xB,x9〉;〈x0,x6〉;〈xA,xF〉;〈xD,xA〉;〈xD,xC〉 -;〈xC,x6〉;〈x3,xF〉;〈x8,xD〉;〈x7,x9〉;〈x9,x5〉;〈xD,xA〉;〈x5,xB〉;〈x9,x2〉;〈xE,xE〉;〈x3,xC〉;〈xF,xE〉;〈x4,x9〉;〈x5,xA〉;〈x1,x0〉;〈x4,xD〉;〈x8,x9〉 ]. - -ndefinition dTest_random_ex17 ≝ -[〈x8,x3〉;〈x2,x6〉;〈xE,xC〉;〈x8,xD〉;〈xC,x9〉;〈x7,x7〉;〈xE,xE〉;〈xF,x1〉;〈x4,x0〉;〈x6,xD〉;〈x4,x9〉;〈x5,x7〉;〈x9,xB〉;〈xC,x4〉;〈x1,xF〉;〈x8,x0〉 -;〈x9,x5〉;〈xB,xC〉;〈xE,x8〉;〈xF,x9〉;〈xD,x7〉;〈x1,x4〉;〈x3,xE〉;〈xC,x3〉;〈x6,xF〉;〈x8,xF〉;〈x7,x2〉;〈xD,x5〉;〈xB,xE〉;〈x8,xA〉;〈xA,x3〉;〈xF,x7〉 ]. - -ndefinition dTest_random_ex18 ≝ -[〈x6,x0〉;〈x3,xA〉;〈x7,x4〉;〈xF,xB〉;〈xB,xD〉;〈x7,x4〉;〈x8,x3〉;〈xE,x3〉;〈x9,xD〉;〈xD,x9〉;〈xB,x8〉;〈x1,x3〉;〈x5,x0〉;〈x4,x0〉;〈x8,xA〉;〈x9,x6〉 -;〈x3,xA〉;〈xA,x6〉;〈xE,xC〉;〈x7,xC〉;〈x1,x5〉;〈x8,x7〉;〈x4,xD〉;〈x6,xA〉;〈xA,xA〉;〈xE,x0〉;〈xB,xA〉;〈xF,xF〉;〈x3,xB〉;〈xE,x2〉;〈x5,x1〉;〈x2,x2〉 ]. - -ndefinition dTest_random_ex19 ≝ -[〈x2,x2〉;〈x1,xF〉;〈xA,x1〉;〈x2,x1〉;〈xA,xF〉;〈x3,x7〉;〈x8,xA〉;〈xD,xF〉;〈xE,x3〉;〈x6,x9〉;〈xE,xE〉;〈xC,x4〉;〈xE,x7〉;〈x7,x1〉;〈x9,x6〉;〈x1,x1〉 -;〈xE,x4〉;〈x3,x9〉;〈xE,x5〉;〈xA,xF〉;〈xF,x5〉;〈x5,x7〉;〈xE,xB〉;〈x5,x5〉;〈x6,x5〉;〈x8,xB〉;〈x3,xE〉;〈x8,xD〉;〈x4,x6〉;〈x5,x3〉;〈xB,x2〉;〈x1,x9〉 ]. - -ndefinition dTest_random_ex1A ≝ -[〈x3,x4〉;〈xE,x9〉;〈x4,xA〉;〈x4,xB〉;〈x5,x2〉;〈x3,x0〉;〈x3,xF〉;〈xA,x7〉;〈x4,xF〉;〈x1,xA〉;〈xB,x8〉;〈x6,x4〉;〈x5,xB〉;〈xD,x9〉;〈x6,xD〉;〈x6,x1〉 -;〈xA,x5〉;〈xC,xF〉;〈x8,xC〉;〈xD,xD〉;〈xE,x6〉;〈xD,x5〉;〈x3,x6〉;〈x0,xC〉;〈x8,xD〉;〈xF,x7〉;〈x4,xE〉;〈x9,xC〉;〈xB,xF〉;〈x2,xB〉;〈x4,x4〉;〈xD,x1〉 ]. - -ndefinition dTest_random_ex1B ≝ -[〈xC,x0〉;〈x8,x0〉;〈x0,x8〉;〈xA,xD〉;〈xC,xE〉;〈xB,xD〉;〈x4,xC〉;〈x5,x3〉;〈x6,x5〉;〈xB,x6〉;〈x4,x8〉;〈xF,x6〉;〈x6,x4〉;〈x7,xC〉;〈x9,x8〉;〈x1,x0〉 -;〈x9,xD〉;〈xF,xD〉;〈x4,x9〉;〈xC,x4〉;〈xD,xD〉;〈x1,x4〉;〈xB,x6〉;〈x6,xF〉;〈x3,xB〉;〈x4,x6〉;〈xD,x7〉;〈x1,xA〉;〈x4,x4〉;〈xA,x4〉;〈x8,x1〉;〈x3,x1〉 ]. - -ndefinition dTest_random_ex1C ≝ -[〈xA,x2〉;〈x4,x0〉;〈x7,x0〉;〈x3,x9〉;〈x9,xA〉;〈x4,xC〉;〈x4,xF〉;〈x9,x3〉;〈x9,xD〉;〈xD,x4〉;〈x9,x7〉;〈x3,x9〉;〈xA,x8〉;〈xA,x8〉;〈xF,x9〉;〈xB,x3〉 -;〈xE,x7〉;〈xD,x8〉;〈x4,xD〉;〈x6,xD〉;〈x8,x8〉;〈x6,xB〉;〈x5,x4〉;〈x5,x5〉;〈x9,x2〉;〈x1,x9〉;〈xE,x4〉;〈xB,x1〉;〈xE,x3〉;〈x4,x6〉;〈xD,x5〉;〈x6,xC〉 ]. - -ndefinition dTest_random_ex1D ≝ -[〈xF,x9〉;〈x3,x3〉;〈xE,x5〉;〈xD,x2〉;〈x7,x7〉;〈x1,x8〉;〈x8,x6〉;〈x1,x4〉;〈x7,xE〉;〈x1,xE〉;〈xC,x8〉;〈xB,x4〉;〈xC,xE〉;〈xC,x7〉;〈x5,x7〉;〈x2,xD〉 -;〈x5,x2〉;〈xE,x7〉;〈x5,x7〉;〈x9,xB〉;〈x1,xA〉;〈x4,x9〉;〈x0,x9〉;〈x4,xB〉;〈xF,x6〉;〈xB,x5〉;〈x0,xA〉;〈x2,xC〉;〈xB,xA〉;〈x1,xF〉;〈x2,x6〉;〈x3,x8〉 ]. - -ndefinition dTest_random_ex1E ≝ -[〈x6,x0〉;〈x3,x4〉;〈xC,x4〉;〈x8,x9〉;〈xB,xF〉;〈x0,x4〉;〈x5,xF〉;〈xF,x4〉;〈x1,x1〉;〈xF,x3〉;〈x4,xA〉;〈xE,x2〉;〈xD,x8〉;〈x3,x6〉;〈xF,xA〉;〈x4,x3〉 -;〈x0,xC〉;〈x6,x0〉;〈x5,x1〉;〈x2,xD〉;〈x0,x3〉;〈xF,xC〉;〈x9,x2〉;〈x2,x1〉;〈xC,xA〉;〈x7,x5〉;〈x6,x6〉;〈xD,xC〉;〈x8,x4〉;〈xC,x4〉;〈x6,xF〉;〈xF,x0〉 ]. - -ndefinition dTest_random_ex1F ≝ -[〈x0,x4〉;〈x5,x2〉;〈xA,xB〉;〈x9,xA〉;〈xC,xE〉;〈xA,xA〉;〈x2,xF〉;〈x3,x6〉;〈xF,x3〉;〈xA,x7〉;〈x4,x2〉;〈x0,x7〉;〈x5,xE〉;〈xB,x6〉;〈x5,xB〉;〈x9,x8〉 -;〈x7,x9〉;〈x4,x3〉;〈x8,x8〉;〈x9,xA〉;〈x0,xA〉;〈x5,x5〉;〈xE,x3〉;〈x9,x8〉;〈x7,x5〉;〈xA,x2〉;〈xE,xA〉;〈xB,x9〉;〈x3,x2〉;〈x4,x1〉;〈x0,x7〉;〈x3,x8〉 ]. - -ndefinition dTest_random_ex20 ≝ -[〈xB,x1〉;〈x0,x3〉;〈x4,xE〉;〈x6,xF〉;〈x9,x7〉;〈x3,xC〉;〈x5,x4〉;〈xB,xB〉;〈xB,xC〉;〈x0,xB〉;〈x0,xC〉;〈xA,xB〉;〈x3,xB〉;〈x2,x8〉;〈xA,xA〉;〈x0,x4〉 -;〈x5,x0〉;〈xA,x3〉;〈x6,xB〉;〈xF,xA〉;〈xF,x0〉;〈xE,x6〉;〈x1,x8〉;〈xD,x8〉;〈x7,xA〉;〈x5,xF〉;〈x0,x3〉;〈x8,x2〉;〈x9,x6〉;〈x9,xA〉;〈xB,xF〉;〈x1,x5〉 ]. - -ndefinition dTest_random_ex21 ≝ -[〈x8,x5〉;〈xE,xF〉;〈xB,x3〉;〈x7,xB〉;〈xE,xE〉;〈xE,xF〉;〈x1,x0〉;〈x6,x9〉;〈xC,x2〉;〈xF,x9〉;〈x2,xD〉;〈x8,x1〉;〈xF,x3〉;〈x0,xE〉;〈xC,x3〉;〈x7,xF〉 -;〈xD,xD〉;〈x2,xE〉;〈x2,xA〉;〈xB,xD〉;〈xE,xA〉;〈x9,x2〉;〈xF,xF〉;〈xF,xA〉;〈x7,xB〉;〈xD,x3〉;〈x3,x0〉;〈x7,x5〉;〈x6,x7〉;〈xA,x8〉;〈x0,xF〉;〈x2,x1〉 ]. - -ndefinition dTest_random_ex22 ≝ -[〈xD,xC〉;〈xE,x5〉;〈xE,x2〉;〈x8,x9〉;〈x2,x9〉;〈xC,x5〉;〈xA,x3〉;〈xA,x2〉;〈x4,x2〉;〈x3,xF〉;〈xA,x3〉;〈x5,x8〉;〈xE,x0〉;〈x7,xC〉;〈x0,x3〉;〈xF,xF〉 -;〈x2,x8〉;〈x8,xB〉;〈x8,xB〉;〈x1,x2〉;〈xD,x8〉;〈xA,x8〉;〈x7,x6〉;〈xB,x9〉;〈xE,x2〉;〈xF,xE〉;〈x2,x1〉;〈x3,xF〉;〈xA,xC〉;〈x4,x6〉;〈xB,xC〉;〈xF,x8〉 ]. - -ndefinition dTest_random_ex23 ≝ -[〈xD,x3〉;〈xE,xB〉;〈xF,xC〉;〈x9,xF〉;〈xE,x7〉;〈x6,x1〉;〈xC,xB〉;〈xB,xF〉;〈x4,xE〉;〈xC,x4〉;〈x9,x7〉;〈x1,xE〉;〈x0,xD〉;〈x7,x9〉;〈x8,x3〉;〈xA,xB〉 -;〈x4,xC〉;〈x2,x6〉;〈x6,x3〉;〈x6,xF〉;〈xE,xE〉;〈x5,x9〉;〈x8,x1〉;〈x0,x2〉;〈x2,xC〉;〈xE,xD〉;〈x6,xF〉;〈x0,x4〉;〈x1,x0〉;〈xE,x0〉;〈xD,xA〉;〈xB,xE〉 ]. - -ndefinition dTest_random_ex24 ≝ -[〈xE,xE〉;〈x5,x7〉;〈xB,x0〉;〈x3,x1〉;〈x4,x1〉;〈xD,xC〉;〈x3,xC〉;〈xC,xC〉;〈x5,x8〉;〈x2,x8〉;〈x2,xC〉;〈x1,xB〉;〈x8,x6〉;〈xD,x6〉;〈xF,x9〉;〈xD,x5〉 -;〈x4,xA〉;〈xE,xA〉;〈x0,xB〉;〈x2,x0〉;〈x2,xC〉;〈x4,x2〉;〈xC,xE〉;〈x4,x5〉;〈x2,xB〉;〈x0,x1〉;〈xA,xA〉;〈xB,x1〉;〈x6,xE〉;〈xB,x7〉;〈xB,x7〉;〈x2,x8〉 ]. - -ndefinition dTest_random_ex25 ≝ -[〈x9,x5〉;〈x1,x9〉;〈xA,x7〉;〈x5,xC〉;〈x4,xE〉;〈x7,xB〉;〈x3,xE〉;〈xD,x3〉;〈x9,x0〉;〈x8,x6〉;〈x7,x1〉;〈x1,x4〉;〈xD,x2〉;〈xD,x4〉;〈xB,x4〉;〈xF,x2〉 -;〈x3,x1〉;〈x2,x8〉;〈x4,x5〉;〈xF,xD〉;〈x7,x8〉;〈x5,xD〉;〈xF,xA〉;〈xF,x3〉;〈x9,x5〉;〈x4,xD〉;〈x3,x1〉;〈xB,x8〉;〈xC,xC〉;〈x2,x1〉;〈x1,x9〉;〈x4,x2〉 ]. - -ndefinition dTest_random_ex26 ≝ -[〈x2,xA〉;〈xF,x2〉;〈xB,xA〉;〈x0,x4〉;〈x9,xF〉;〈x4,x3〉;〈x4,x5〉;〈x1,xC〉;〈x7,x4〉;〈xB,xB〉;〈x7,x0〉;〈x5,xE〉;〈x0,x1〉;〈xA,xC〉;〈x6,xD〉;〈xD,x7〉 -;〈x9,xC〉;〈x9,xD〉;〈x1,xA〉;〈x9,x8〉;〈xB,x1〉;〈xF,xC〉;〈x6,x1〉;〈xA,x3〉;〈x4,x1〉;〈x4,x1〉;〈xA,xF〉;〈x1,xD〉;〈xE,x1〉;〈x3,x2〉;〈x1,x9〉;〈x6,x0〉 ]. - -ndefinition dTest_random_ex27 ≝ -[〈x2,x9〉;〈x9,x7〉;〈x8,x5〉;〈x5,x3〉;〈x5,x3〉;〈x9,x1〉;〈xB,x3〉;〈x9,x4〉;〈xD,x5〉;〈x9,xD〉;〈x4,xC〉;〈x3,x6〉;〈x0,xE〉;〈x8,x4〉;〈xA,x1〉;〈x4,x6〉 -;〈x6,xA〉;〈x1,xF〉;〈xF,x3〉;〈x6,xB〉;〈xB,xE〉;〈x4,xA〉;〈x1,x9〉;〈x7,x5〉;〈xF,xC〉;〈xC,x6〉;〈xE,xA〉;〈x7,xE〉;〈xD,x1〉;〈x3,x3〉;〈x6,x7〉;〈xB,x7〉 ]. - -ndefinition dTest_random_ex28 ≝ -[〈xE,xE〉;〈x5,x9〉;〈xE,x2〉;〈xD,xD〉;〈x2,x2〉;〈x8,xC〉;〈x9,xB〉;〈x3,xE〉;〈x9,x8〉;〈xF,xC〉;〈x1,x3〉;〈xE,x2〉;〈x0,xC〉;〈x4,xE〉;〈x3,x1〉;〈x8,x7〉 -;〈x6,x7〉;〈x6,xA〉;〈x4,xC〉;〈x4,xC〉;〈x7,x2〉;〈x0,x0〉;〈x0,x5〉;〈x1,xF〉;〈xF,x6〉;〈x3,x0〉;〈xE,xE〉;〈xD,xE〉;〈xB,x1〉;〈x4,xC〉;〈xF,x7〉;〈xE,xC〉 ]. - -ndefinition dTest_random_ex29 ≝ -[〈x2,xC〉;〈x4,x0〉;〈x6,xB〉;〈x6,x8〉;〈x9,x0〉;〈x8,x8〉;〈x6,xF〉;〈xB,x3〉;〈x4,x7〉;〈x6,x2〉;〈x9,x2〉;〈x9,xB〉;〈x2,xB〉;〈x3,x2〉;〈x4,x0〉;〈xA,x7〉 -;〈x8,x9〉;〈x4,x0〉;〈x2,x3〉;〈x5,xC〉;〈xF,x9〉;〈x2,x9〉;〈x6,x2〉;〈xA,xE〉;〈x5,xB〉;〈xC,x9〉;〈x2,xC〉;〈x9,x2〉;〈x6,xF〉;〈xF,x5〉;〈xA,x0〉;〈x0,xE〉 ]. - -ndefinition dTest_random_ex2A ≝ -[〈xD,xE〉;〈xF,x9〉;〈x0,x9〉;〈x1,x0〉;〈x3,x9〉;〈x4,x6〉;〈xC,x5〉;〈xE,x2〉;〈x8,x3〉;〈xD,x5〉;〈x8,xE〉;〈x4,x6〉;〈x4,xC〉;〈xA,xC〉;〈x7,xF〉;〈x4,xF〉 -;〈xC,x1〉;〈x4,xF〉;〈x1,xA〉;〈x6,x1〉;〈x9,x6〉;〈x0,xB〉;〈x0,x0〉;〈x6,xF〉;〈x2,x6〉;〈x8,xC〉;〈xE,xE〉;〈x9,x3〉;〈x1,xB〉;〈x9,xE〉;〈xA,x5〉;〈x9,x6〉 ]. - -ndefinition dTest_random_ex2B ≝ -[〈x2,xA〉;〈xE,xB〉;〈x4,x6〉;〈x5,xF〉;〈x3,xC〉;〈xD,x6〉;〈x2,xD〉;〈x9,x4〉;〈x6,xB〉;〈xF,x4〉;〈xD,xA〉;〈x6,x9〉;〈x5,x9〉;〈xA,xC〉;〈xB,xD〉;〈x9,xE〉 -;〈x4,x8〉;〈x0,x2〉;〈xD,xC〉;〈x5,xC〉;〈x6,x0〉;〈x2,xA〉;〈x6,xE〉;〈xC,xA〉;〈x6,xE〉;〈x1,xF〉;〈xD,x4〉;〈x3,xA〉;〈xB,x0〉;〈x9,xE〉;〈x8,xF〉;〈xA,xB〉 ]. - -ndefinition dTest_random_ex2C ≝ -[〈xB,x2〉;〈x0,x2〉;〈x4,x7〉;〈x7,xD〉;〈xA,xB〉;〈xD,xB〉;〈xB,x5〉;〈x6,xD〉;〈xE,x2〉;〈x8,x9〉;〈x4,xD〉;〈x0,x4〉;〈xB,xE〉;〈xF,xA〉;〈x2,x2〉;〈x1,x4〉 -;〈x7,x1〉;〈x1,x2〉;〈x1,xB〉;〈x0,xD〉;〈xB,xA〉;〈x5,xA〉;〈x6,xC〉;〈x1,xE〉;〈x3,xA〉;〈x0,xF〉;〈x6,xE〉;〈x4,x4〉;〈xC,x8〉;〈xB,x5〉;〈x8,xC〉;〈x0,x3〉 ]. - -ndefinition dTest_random_ex2D ≝ -[〈x0,x6〉;〈x6,x4〉;〈x8,x5〉;〈x2,x8〉;〈x6,x4〉;〈x2,x2〉;〈x8,x1〉;〈x7,x6〉;〈xF,xE〉;〈xF,xA〉;〈x6,x2〉;〈x9,x1〉;〈xB,xE〉;〈xB,xC〉;〈x6,x1〉;〈x4,xB〉 -;〈x7,xE〉;〈x5,x0〉;〈xB,xC〉;〈xE,xE〉;〈x6,x3〉;〈xC,xF〉;〈x1,xD〉;〈xF,xD〉;〈x6,x2〉;〈x5,xC〉;〈x8,x5〉;〈x9,xE〉;〈xA,x5〉;〈x2,x6〉;〈xE,x7〉;〈x4,x6〉 ]. - -ndefinition dTest_random_ex2E ≝ -[〈x3,xB〉;〈xE,xA〉;〈xB,xE〉;〈x0,x4〉;〈x8,x8〉;〈xF,x2〉;〈x9,x2〉;〈x0,xB〉;〈xD,x9〉;〈xE,x9〉;〈x2,x9〉;〈x3,x8〉;〈x8,x8〉;〈x8,xA〉;〈x6,x9〉;〈x1,x7〉 -;〈x4,xB〉;〈xB,xF〉;〈x0,xC〉;〈xF,x2〉;〈xF,xD〉;〈x7,x3〉;〈x5,x9〉;〈xB,xE〉;〈x5,x4〉;〈x1,xC〉;〈xD,x3〉;〈x3,x1〉;〈x6,x2〉;〈x1,xB〉;〈xB,x7〉;〈x3,x2〉 ]. - -ndefinition dTest_random_ex2F ≝ -[〈xA,x4〉;〈xF,x1〉;〈x7,x0〉;〈x9,xA〉;〈x4,x6〉;〈xA,x1〉;〈x1,xC〉;〈x0,x4〉;〈x6,xC〉;〈xF,x2〉;〈xE,x6〉;〈xC,x1〉;〈xA,x4〉;〈xF,x2〉;〈x2,xA〉;〈x4,xB〉 -;〈x3,x5〉;〈x9,xB〉;〈x9,x9〉;〈xF,xF〉;〈x0,x1〉;〈x1,x3〉;〈xF,x9〉;〈x5,xC〉;〈x3,xC〉;〈x5,x1〉;〈x8,xA〉;〈xA,x5〉;〈x5,xF〉;〈x9,xE〉;〈x5,xE〉;〈xC,x6〉 ]. - -ndefinition dTest_random_ex30 ≝ -[〈x2,x1〉;〈x3,x7〉;〈xD,x2〉;〈xB,x9〉;〈x9,x8〉;〈xA,x1〉;〈x6,x0〉;〈xE,x9〉;〈x4,x5〉;〈xC,xA〉;〈xD,x7〉;〈xB,xD〉;〈xC,xF〉;〈x0,xF〉;〈x2,x4〉;〈xE,x5〉 -;〈x7,x9〉;〈x4,xB〉;〈x1,xC〉;〈x5,x7〉;〈x3,xA〉;〈x2,x4〉;〈x2,x2〉;〈x0,x8〉;〈x3,x3〉;〈xE,x2〉;〈xA,x2〉;〈x5,x8〉;〈x2,x5〉;〈x5,x4〉;〈x7,x1〉;〈x2,xB〉 ]. - -ndefinition dTest_random_ex31 ≝ -[〈xF,xF〉;〈xE,xD〉;〈x4,x8〉;〈xF,x6〉;〈x2,x3〉;〈x3,x1〉;〈xB,xA〉;〈x5,x1〉;〈x9,xF〉;〈xA,xA〉;〈xC,xC〉;〈x0,x3〉;〈x1,x5〉;〈xC,x7〉;〈x2,xD〉;〈xD,x3〉 -;〈xE,xB〉;〈x8,xF〉;〈x8,x4〉;〈x4,x0〉;〈x5,x3〉;〈xA,xD〉;〈x6,x7〉;〈xE,xC〉;〈xA,xF〉;〈xD,xC〉;〈x1,xC〉;〈x7,x4〉;〈x6,xB〉;〈xA,xD〉;〈xC,xD〉;〈xA,x7〉 ]. - -ndefinition dTest_random_ex32 ≝ -[〈x1,x1〉;〈x1,x0〉;〈xC,xF〉;〈xB,xE〉;〈xA,x1〉;〈x0,x1〉;〈x3,xF〉;〈xC,x0〉;〈x8,x5〉;〈x2,x8〉;〈x6,xB〉;〈xC,x3〉;〈x6,xD〉;〈xD,x8〉;〈x7,x5〉;〈x5,xA〉 -;〈xF,x0〉;〈x2,x2〉;〈x4,xB〉;〈x9,xC〉;〈x3,x1〉;〈xE,x4〉;〈xE,x7〉;〈xC,x6〉;〈xF,xC〉;〈x3,x0〉;〈xD,x5〉;〈xF,x9〉;〈x1,xA〉;〈x4,x0〉;〈x1,xF〉;〈x6,xD〉 ]. - -ndefinition dTest_random_ex33 ≝ -[〈xD,x5〉;〈x7,x8〉;〈xB,x5〉;〈x7,x6〉;〈xC,x9〉;〈xE,x1〉;〈xD,xF〉;〈x1,x2〉;〈x6,x1〉;〈xD,xF〉;〈x9,xF〉;〈x5,x7〉;〈x7,xD〉;〈x0,xB〉;〈xA,xD〉;〈x5,xA〉 -;〈xA,x1〉;〈x8,x4〉;〈xE,x5〉;〈xF,x7〉;〈xB,xC〉;〈xD,x3〉;〈xA,x5〉;〈xB,x4〉;〈x8,x5〉;〈x6,x7〉;〈x3,x6〉;〈xF,xC〉;〈xB,x1〉;〈xB,x3〉;〈xC,xB〉;〈x1,xE〉 ]. - -ndefinition dTest_random_ex34 ≝ -[〈xE,xC〉;〈x6,xE〉;〈xE,x1〉;〈x1,xC〉;〈xA,x5〉;〈x5,x3〉;〈x9,x8〉;〈xF,x6〉;〈xD,xF〉;〈x4,x1〉;〈x1,x3〉;〈x2,xE〉;〈x7,xF〉;〈x0,xE〉;〈x3,x8〉;〈x3,xC〉 -;〈xD,x4〉;〈x8,xC〉;〈x2,xA〉;〈x2,x8〉;〈x4,xE〉;〈x7,xE〉;〈x0,xE〉;〈xF,x7〉;〈xC,xA〉;〈x3,xE〉;〈xE,x4〉;〈xB,x4〉;〈x0,x5〉;〈x5,x8〉;〈xD,xC〉;〈x7,x8〉 ]. - -ndefinition dTest_random_ex35 ≝ -[〈xD,x9〉;〈xF,x9〉;〈x7,x9〉;〈x8,x4〉;〈x0,x2〉;〈x3,xF〉;〈xC,xF〉;〈x3,x8〉;〈xD,x7〉;〈x2,x6〉;〈x1,xD〉;〈x1,x8〉;〈x4,xD〉;〈xE,xA〉;〈x7,xA〉;〈xD,x4〉 -;〈x2,x4〉;〈x0,xD〉;〈x4,xD〉;〈x9,x0〉;〈x1,x7〉;〈x1,xE〉;〈x6,xE〉;〈xB,x6〉;〈xC,xC〉;〈xC,x0〉;〈xB,x0〉;〈x5,xE〉;〈x9,x9〉;〈x6,xD〉;〈xC,xF〉;〈xE,xE〉 ]. - -ndefinition dTest_random_ex36 ≝ -[〈x2,x9〉;〈xC,xF〉;〈xA,x2〉;〈x0,xC〉;〈xA,xB〉;〈x7,x4〉;〈x2,x9〉;〈x4,xE〉;〈x8,x2〉;〈x9,x3〉;〈x6,x9〉;〈x7,xB〉;〈xE,xC〉;〈xC,x7〉;〈x8,x9〉;〈xC,xA〉 -;〈xD,xD〉;〈xA,xC〉;〈x6,x5〉;〈x8,x0〉;〈x1,x4〉;〈x0,x9〉;〈x5,x5〉;〈x0,xE〉;〈x8,x4〉;〈x5,xE〉;〈x6,xF〉;〈x3,x4〉;〈x1,x8〉;〈xC,x9〉;〈x8,xB〉;〈xE,x4〉 ]. - -ndefinition dTest_random_ex37 ≝ -[〈x3,xE〉;〈xC,x4〉;〈x1,x6〉;〈xA,x4〉;〈x1,x9〉;〈x3,x4〉;〈x0,xE〉;〈x5,xE〉;〈xF,x9〉;〈x0,x3〉;〈x1,x3〉;〈x7,x2〉;〈x2,x7〉;〈x2,x8〉;〈xA,x7〉;〈x6,xD〉 -;〈xC,x1〉;〈x1,xD〉;〈xF,x0〉;〈x2,x8〉;〈xF,xB〉;〈xF,x6〉;〈x3,x8〉;〈x0,x1〉;〈xF,x9〉;〈xB,xC〉;〈x6,x6〉;〈xF,x8〉;〈x6,xE〉;〈xD,x1〉;〈xB,x5〉;〈x3,x8〉 ]. - -ndefinition dTest_random_ex38 ≝ -[〈x4,x3〉;〈xB,x6〉;〈x6,x8〉;〈xA,xC〉;〈x0,x9〉;〈xF,xD〉;〈x0,x9〉;〈x6,x8〉;〈xE,x0〉;〈x2,x2〉;〈xA,xF〉;〈x4,x0〉;〈x2,x6〉;〈x0,xC〉;〈x5,x2〉;〈xA,x7〉 -;〈xA,xD〉;〈xC,x3〉;〈x8,x2〉;〈xD,xC〉;〈x3,xC〉;〈x6,x5〉;〈xF,x2〉;〈xE,x8〉;〈xC,x0〉;〈x0,x6〉;〈x6,x4〉;〈xB,x1〉;〈x2,x0〉;〈x9,x5〉;〈x2,x2〉;〈xD,xD〉 ]. - -ndefinition dTest_random_ex39 ≝ -[〈xA,xD〉;〈xF,xF〉;〈x1,xB〉;〈x8,xB〉;〈xB,x6〉;〈x4,xA〉;〈xB,xB〉;〈x9,x8〉;〈x1,xA〉;〈xE,xC〉;〈x7,xB〉;〈xA,x6〉;〈x2,xC〉;〈xE,x1〉;〈xC,x7〉;〈xD,xC〉 -;〈x1,x9〉;〈x0,x6〉;〈x0,xA〉;〈x9,xF〉;〈x5,x2〉;〈x2,xB〉;〈xC,xA〉;〈x2,xF〉;〈x4,x0〉;〈xF,x8〉;〈xE,xA〉;〈x8,x7〉;〈x8,x9〉;〈xF,xD〉;〈x5,xD〉;〈x0,x0〉 ]. - -ndefinition dTest_random_ex3A ≝ -[〈x6,xE〉;〈x0,x0〉;〈x0,xD〉;〈x3,x0〉;〈x4,x3〉;〈x5,xA〉;〈x8,xF〉;〈x8,xA〉;〈xA,x4〉;〈x5,x0〉;〈x8,xF〉;〈x0,xC〉;〈x7,x7〉;〈xF,x2〉;〈x6,x5〉;〈xE,x4〉 -;〈x2,xD〉;〈xE,x5〉;〈xA,x8〉;〈x7,xF〉;〈x7,x8〉;〈xE,x3〉;〈x9,x5〉;〈xD,xA〉;〈x0,x7〉;〈x2,x9〉;〈x5,x1〉;〈x9,x4〉;〈xE,x4〉;〈x0,x1〉;〈xB,xF〉;〈x6,xE〉 ]. - -ndefinition dTest_random_ex3B ≝ -[〈x9,x8〉;〈x9,xC〉;〈x9,x0〉;〈xA,x8〉;〈x0,xA〉;〈x3,xD〉;〈x3,xC〉;〈x5,x0〉;〈xE,xB〉;〈x1,x2〉;〈xC,x4〉;〈x5,xF〉;〈x4,x7〉;〈x7,xB〉;〈x2,xC〉;〈xD,xF〉 -;〈x7,x8〉;〈x1,x3〉;〈x7,x4〉;〈xE,x0〉;〈x7,xB〉;〈x7,x1〉;〈x4,x7〉;〈x4,x8〉;〈x1,xB〉;〈xE,x3〉;〈x6,xB〉;〈x0,xB〉;〈x4,xB〉;〈x5,x9〉;〈x9,x3〉;〈xD,xF〉 ]. - -ndefinition dTest_random_ex3C ≝ -[〈xE,x1〉;〈x1,xB〉;〈xD,x0〉;〈xE,xD〉;〈x4,x7〉;〈x4,xD〉;〈xC,x2〉;〈xD,xE〉;〈x5,xC〉;〈xD,xA〉;〈x9,x5〉;〈xC,x8〉;〈x1,x0〉;〈x7,x7〉;〈x7,xF〉;〈xC,x0〉 -;〈xA,x7〉;〈xD,x3〉;〈xD,x3〉;〈xD,x8〉;〈x3,x4〉;〈xA,x1〉;〈x1,x5〉;〈xE,x0〉;〈x0,x4〉;〈x1,xE〉;〈x8,x2〉;〈xC,xA〉;〈xD,x9〉;〈x1,x1〉;〈xB,x1〉;〈xC,x9〉 ]. - -ndefinition dTest_random_ex3D ≝ -[〈x4,xC〉;〈x4,xB〉;〈x0,x9〉;〈x4,x8〉;〈xF,xC〉;〈xD,xD〉;〈x6,xE〉;〈xC,xA〉;〈x7,x6〉;〈xA,xE〉;〈x8,xE〉;〈x3,xB〉;〈xF,xB〉;〈x6,x5〉;〈x8,x3〉;〈x1,xD〉 -;〈xD,xB〉;〈xA,xE〉;〈x4,xF〉;〈xC,x6〉;〈x1,xE〉;〈xC,x5〉;〈xC,xC〉;〈x7,xC〉;〈x2,x8〉;〈xF,x9〉;〈xD,x2〉;〈x8,x6〉;〈x1,x5〉;〈xF,xA〉;〈x4,x1〉;〈x4,x5〉 ]. - -ndefinition dTest_random_ex3E ≝ -[〈x2,xE〉;〈x9,x5〉;〈xB,xF〉;〈x0,xD〉;〈x8,xB〉;〈x8,xD〉;〈x1,x1〉;〈x9,xC〉;〈xB,x8〉;〈xF,xB〉;〈x2,x6〉;〈xD,x6〉;〈x9,x1〉;〈x0,xD〉;〈xC,xD〉;〈x0,x7〉 -;〈x5,x0〉;〈xF,xA〉;〈x2,x9〉;〈x3,xF〉;〈x0,xC〉;〈x2,xB〉;〈xF,xE〉;〈x9,x7〉;〈x5,x5〉;〈x5,xA〉;〈x6,xD〉;〈x9,x6〉;〈x0,x5〉;〈x0,x9〉;〈x4,x5〉;〈xE,xF〉 ]. - -ndefinition dTest_random_ex3F ≝ -[〈x0,xF〉;〈x7,x4〉;〈x9,x3〉;〈x6,xC〉;〈x8,x2〉;〈x3,x7〉;〈xE,xB〉;〈x5,x0〉;〈xF,x5〉;〈xC,x4〉;〈x0,xB〉;〈x3,x8〉;〈x2,xD〉;〈x8,xA〉;〈x9,x3〉;〈x6,xD〉 -;〈x1,xD〉;〈xE,x5〉;〈xF,x7〉;〈xE,x7〉;〈xD,x7〉;〈x5,xC〉;〈xB,x4〉;〈x5,x0〉;〈x7,x5〉;〈x0,xD〉;〈xF,x3〉;〈xC,xE〉;〈x3,x1〉;〈xF,x1〉;〈x8,xE〉;〈x8,xF〉 ]. - -ndefinition dTest_random_ex40 ≝ -[〈xD,xB〉;〈x1,x4〉;〈xF,x6〉;〈x0,x3〉;〈xA,xB〉;〈xA,xE〉;〈xB,xC〉;〈xE,xB〉;〈xC,x8〉;〈x6,x7〉;〈xC,xC〉;〈xF,xF〉;〈x4,xF〉;〈xC,x6〉;〈x2,x9〉;〈x9,x5〉 -;〈xB,xC〉;〈x6,x5〉;〈x5,x2〉;〈xF,x2〉;〈x3,x5〉;〈xC,x4〉;〈xF,x4〉;〈x9,xB〉;〈x4,x5〉;〈x1,xC〉;〈xD,xB〉;〈x6,x1〉;〈xF,xE〉;〈x3,xF〉;〈xB,x9〉;〈xD,x8〉 ]. - -ndefinition dTest_random_ex41 ≝ -[〈xF,x1〉;〈xA,xC〉;〈x0,x7〉;〈xA,x4〉;〈xB,x8〉;〈x8,x8〉;〈x9,x5〉;〈xB,x8〉;〈x5,x6〉;〈x3,x2〉;〈x5,xA〉;〈x3,xE〉;〈x2,x2〉;〈x0,xB〉;〈x9,x6〉;〈xE,xE〉 -;〈x6,xF〉;〈x1,xE〉;〈x3,x2〉;〈x4,x9〉;〈x4,xF〉;〈xC,xC〉;〈xD,xB〉;〈x5,x1〉;〈x4,xD〉;〈xD,x1〉;〈x4,xF〉;〈x0,x9〉;〈x5,xA〉;〈xA,xC〉;〈xE,x7〉;〈x8,x6〉 ]. - -ndefinition dTest_random_ex42 ≝ -[〈x5,x8〉;〈xA,x5〉;〈xA,x7〉;〈x5,xE〉;〈x3,x6〉;〈x1,x1〉;〈x3,xA〉;〈x8,x9〉;〈x8,x2〉;〈xD,xC〉;〈x6,x2〉;〈x0,xE〉;〈xA,xB〉;〈x2,xB〉;〈x2,x5〉;〈xF,x9〉 -;〈x7,x7〉;〈x8,x6〉;〈x1,xD〉;〈x7,x9〉;〈x5,x1〉;〈xB,xD〉;〈x9,x8〉;〈xB,x7〉;〈xB,xB〉;〈xF,x6〉;〈xD,x9〉;〈x6,x6〉;〈x0,x1〉;〈x1,x2〉;〈xE,xB〉;〈x0,xA〉 ]. - -ndefinition dTest_random_ex43 ≝ -[〈xC,xD〉;〈x1,xA〉;〈xA,xA〉;〈xC,xC〉;〈x6,x5〉;〈x4,x2〉;〈x8,xF〉;〈x2,xA〉;〈x4,x8〉;〈xC,x6〉;〈xB,xA〉;〈xD,x8〉;〈x2,xD〉;〈x2,x9〉;〈xE,x8〉;〈x5,x7〉 -;〈x7,x7〉;〈x7,xA〉;〈xB,x4〉;〈x4,x9〉;〈x6,x5〉;〈x4,x3〉;〈x5,x7〉;〈xF,xE〉;〈xC,x6〉;〈xC,x7〉;〈x6,x2〉;〈x6,x7〉;〈x5,x8〉;〈xD,x6〉;〈x9,xA〉;〈xC,x8〉 ]. - -ndefinition dTest_random_ex44 ≝ -[〈xE,x8〉;〈x3,x0〉;〈x6,x0〉;〈x7,x3〉;〈x8,x9〉;〈x2,x3〉;〈x0,x8〉;〈x7,xA〉;〈xA,xC〉;〈x5,xD〉;〈x6,xD〉;〈xC,xE〉;〈x0,xC〉;〈x1,xB〉;〈x1,x7〉;〈xC,x1〉 -;〈x4,x2〉;〈x5,x3〉;〈x1,x5〉;〈x7,xC〉;〈x7,x4〉;〈x2,xB〉;〈x2,x5〉;〈x5,x6〉;〈x6,x1〉;〈xE,xC〉;〈x0,xB〉;〈x4,x2〉;〈x0,x4〉;〈xC,xA〉;〈x0,x9〉;〈xA,xB〉 ]. - -ndefinition dTest_random_ex45 ≝ -[〈x1,xB〉;〈xD,x0〉;〈x9,xF〉;〈x6,xA〉;〈x7,xF〉;〈x4,x1〉;〈xF,x8〉;〈xE,xA〉;〈x8,x2〉;〈x8,x1〉;〈x4,x1〉;〈xC,xE〉;〈xC,xE〉;〈x0,xD〉;〈x2,xB〉;〈x3,x3〉 -;〈xA,x3〉;〈x6,x4〉;〈xF,xA〉;〈xA,x6〉;〈x3,x9〉;〈x7,xF〉;〈xF,x6〉;〈xB,x2〉;〈x5,x5〉;〈x6,xB〉;〈xA,xC〉;〈x3,x3〉;〈x9,x3〉;〈xE,x7〉;〈xB,xE〉;〈x3,x4〉 ]. - -ndefinition dTest_random_ex46 ≝ -[〈xC,xF〉;〈xE,xF〉;〈xA,x2〉;〈xE,xE〉;〈xE,xD〉;〈xC,xB〉;〈xB,x0〉;〈x8,x9〉;〈xD,xA〉;〈x3,xB〉;〈xB,xE〉;〈x3,xE〉;〈x3,x3〉;〈x5,x1〉;〈xA,x5〉;〈x3,xC〉 -;〈xC,xC〉;〈xA,x0〉;〈xF,xD〉;〈x3,x9〉;〈xC,xB〉;〈xF,xC〉;〈x1,xF〉;〈x8,xD〉;〈x6,x8〉;〈xD,x4〉;〈x8,xC〉;〈xA,xA〉;〈x8,xE〉;〈x3,xA〉;〈x9,x7〉;〈x2,x6〉 ]. - -ndefinition dTest_random_ex47 ≝ -[〈x6,xB〉;〈xA,xC〉;〈x8,xA〉;〈x4,xB〉;〈x7,x4〉;〈x3,xF〉;〈xB,x7〉;〈xB,xF〉;〈x0,xC〉;〈xE,x6〉;〈xC,xD〉;〈x4,x2〉;〈xF,xA〉;〈xE,xE〉;〈xF,x9〉;〈x0,xC〉 -;〈x2,xC〉;〈x7,x9〉;〈x7,xE〉;〈xD,x8〉;〈x4,x0〉;〈x7,xC〉;〈x3,x8〉;〈x4,x9〉;〈x7,x1〉;〈x7,x5〉;〈xB,x7〉;〈x3,x6〉;〈x0,x7〉;〈x1,xA〉;〈x2,xC〉;〈x1,xE〉 ]. - -ndefinition dTest_random_ex48 ≝ -[〈x3,xC〉;〈x7,xA〉;〈x3,x8〉;〈x4,xA〉;〈x3,x4〉;〈x2,x0〉;〈x9,x5〉;〈x6,x0〉;〈xF,x7〉;〈xC,x3〉;〈xB,x1〉;〈x6,xE〉;〈xB,x1〉;〈x7,x0〉;〈x7,x4〉;〈x3,xB〉 -;〈x0,xD〉;〈x6,xD〉;〈xF,xB〉;〈xE,x5〉;〈xE,x2〉;〈x6,x6〉;〈x6,x8〉;〈x0,x8〉;〈xF,xB〉;〈x3,xC〉;〈x8,xC〉;〈xD,xD〉;〈x0,x2〉;〈x2,xE〉;〈x6,xE〉;〈xF,x1〉 ]. - -ndefinition dTest_random_ex49 ≝ -[〈xA,xF〉;〈x7,x9〉;〈x6,x7〉;〈xE,x2〉;〈x4,xC〉;〈xA,x5〉;〈x7,x9〉;〈xC,x6〉;〈xB,x5〉;〈xA,xF〉;〈x1,x5〉;〈xF,xE〉;〈xE,x2〉;〈x2,xB〉;〈xC,xA〉;〈xE,x6〉 -;〈x3,xE〉;〈x2,xC〉;〈x5,x8〉;〈x7,x2〉;〈xC,xE〉;〈x7,x1〉;〈x8,xC〉;〈xB,xE〉;〈x2,x0〉;〈x6,x6〉;〈x0,x7〉;〈x6,xF〉;〈xD,x1〉;〈x8,x2〉;〈x3,x1〉;〈xF,x3〉 ]. - -ndefinition dTest_random_ex4A ≝ -[〈x9,x5〉;〈x9,x1〉;〈x1,x2〉;〈xF,x3〉;〈x4,xF〉;〈x6,xC〉;〈xA,x6〉;〈x8,xE〉;〈xB,x2〉;〈x7,x8〉;〈xD,xE〉;〈x7,x9〉;〈xC,x5〉;〈x2,x2〉;〈xF,x3〉;〈x0,x7〉 -;〈xE,x7〉;〈x9,xE〉;〈x9,x2〉;〈x7,x3〉;〈x3,xC〉;〈xA,x1〉;〈xD,xA〉;〈x2,x1〉;〈x2,x3〉;〈x4,x5〉;〈xE,x5〉;〈x7,x4〉;〈x8,x4〉;〈xC,x2〉;〈x6,x8〉;〈x3,x5〉 ]. - -ndefinition dTest_random_ex4B ≝ -[〈x9,xA〉;〈xC,x8〉;〈x2,xE〉;〈x1,xD〉;〈xD,x1〉;〈xA,x6〉;〈xD,xF〉;〈x0,x6〉;〈x7,xF〉;〈x8,xC〉;〈x2,x8〉;〈xF,x6〉;〈xC,x3〉;〈xF,x8〉;〈x6,x2〉;〈xF,x9〉 -;〈x5,x7〉;〈x2,x7〉;〈xD,x1〉;〈xD,x3〉;〈x0,xB〉;〈xA,x3〉;〈x8,x7〉;〈x8,x3〉;〈xC,x9〉;〈x1,x4〉;〈xB,x4〉;〈xC,x5〉;〈xE,xD〉;〈x5,x4〉;〈xE,x1〉;〈xB,x9〉 ]. - -ndefinition dTest_random_ex4C ≝ -[〈x2,x9〉;〈x6,xF〉;〈xE,x3〉;〈x0,xD〉;〈xC,xC〉;〈xF,x6〉;〈x0,xD〉;〈x2,x4〉;〈x4,x5〉;〈x6,xE〉;〈xE,x4〉;〈xD,xB〉;〈xF,x9〉;〈xC,x1〉;〈xD,x4〉;〈xB,x4〉 -;〈xB,x5〉;〈x6,x6〉;〈x1,xC〉;〈x6,xE〉;〈xA,xF〉;〈x4,x0〉;〈xE,x6〉;〈x4,x9〉;〈x7,xE〉;〈x4,x1〉;〈x1,x8〉;〈x8,x7〉;〈xD,xF〉;〈xB,xB〉;〈x6,x0〉;〈x0,x5〉 ]. - -ndefinition dTest_random_ex4D ≝ -[〈xF,x4〉;〈x5,xD〉;〈xA,x1〉;〈xD,x6〉;〈x6,x7〉;〈x2,xA〉;〈xC,x8〉;〈x7,x7〉;〈xF,x9〉;〈x8,xA〉;〈xF,x9〉;〈x2,x6〉;〈xE,xF〉;〈x7,x4〉;〈x5,x8〉;〈x6,xA〉 -;〈xC,x8〉;〈x3,x5〉;〈x1,x0〉;〈xC,x5〉;〈x1,xE〉;〈x0,xB〉;〈x8,x3〉;〈x6,xA〉;〈x4,x4〉;〈x8,xD〉;〈x5,xC〉;〈xF,xB〉;〈xF,xE〉;〈x9,x2〉;〈x0,x3〉;〈x4,x3〉 ]. - -ndefinition dTest_random_ex4E ≝ -[〈x0,x5〉;〈xA,xF〉;〈xC,x0〉;〈xF,x3〉;〈x0,x4〉;〈x2,x8〉;〈x9,xD〉;〈x0,x9〉;〈x3,x5〉;〈xE,x3〉;〈x5,xF〉;〈x4,x5〉;〈xA,xB〉;〈xC,xD〉;〈x8,xC〉;〈xF,xD〉 -;〈x2,xC〉;〈x9,xD〉;〈xA,xF〉;〈x6,x4〉;〈x4,x3〉;〈x8,x0〉;〈x8,x2〉;〈xE,x5〉;〈x8,xE〉;〈x3,xD〉;〈x2,xD〉;〈xD,xB〉;〈xD,xF〉;〈xA,xB〉;〈x0,x8〉;〈x1,x6〉 ]. - -ndefinition dTest_random_ex4F ≝ -[〈xE,xC〉;〈x7,xE〉;〈xA,x7〉;〈xC,xB〉;〈xD,x8〉;〈x5,xC〉;〈x2,xC〉;〈x8,x8〉;〈x9,x8〉;〈xC,x2〉;〈xA,xD〉;〈x1,xD〉;〈xB,x0〉;〈xB,x1〉;〈xC,xE〉;〈x9,x3〉 -;〈xE,x2〉;〈xF,x4〉;〈xD,xB〉;〈xA,x5〉;〈xB,x6〉;〈x4,x9〉;〈x8,x7〉;〈x1,xD〉;〈xA,x2〉;〈x7,x9〉;〈x3,x5〉;〈xB,xE〉;〈x5,x5〉;〈xC,xD〉;〈x6,x3〉;〈x2,xC〉 ]. - -ndefinition dTest_random_ex50 ≝ -[〈x1,x0〉;〈x1,xF〉;〈xE,xC〉;〈x3,xB〉;〈x8,xA〉;〈x3,xF〉;〈x3,x8〉;〈x8,x0〉;〈x1,xC〉;〈x2,xD〉;〈x9,x2〉;〈x5,xF〉;〈xE,x1〉;〈xB,x5〉;〈xB,xC〉;〈x8,x3〉 -;〈xB,x6〉;〈x1,xB〉;〈xE,xD〉;〈x4,xF〉;〈x3,xA〉;〈xC,x4〉;〈xF,xE〉;〈xF,xF〉;〈xC,xB〉;〈x8,x1〉;〈x6,x7〉;〈xC,x2〉;〈x5,x9〉;〈xD,xA〉;〈x0,xA〉;〈x9,xC〉 ]. - -ndefinition dTest_random_ex51 ≝ -[〈x2,x2〉;〈xE,xB〉;〈x9,x3〉;〈xE,x2〉;〈x7,xF〉;〈xA,xC〉;〈x4,xA〉;〈x8,x2〉;〈x8,x1〉;〈x3,xF〉;〈xE,xB〉;〈x8,xB〉;〈x0,xF〉;〈x9,xC〉;〈x4,x1〉;〈x8,x2〉 -;〈x9,xB〉;〈x7,xC〉;〈x5,x1〉;〈xA,x7〉;〈xA,xB〉;〈xA,xD〉;〈x9,x2〉;〈x1,x9〉;〈xF,x0〉;〈xF,xD〉;〈x9,x3〉;〈xF,x6〉;〈xA,xD〉;〈x2,x4〉;〈xC,xB〉;〈xD,xE〉 ]. - -ndefinition dTest_random_ex52 ≝ -[〈xB,x5〉;〈xA,xB〉;〈x8,x1〉;〈x5,x4〉;〈xA,xE〉;〈x2,x4〉;〈x6,x4〉;〈xD,x2〉;〈xD,x0〉;〈xF,xE〉;〈x3,x3〉;〈x2,xA〉;〈x7,x5〉;〈x0,x7〉;〈x8,xF〉;〈x3,xA〉 -;〈x1,x2〉;〈x9,xF〉;〈xB,xE〉;〈x1,xB〉;〈x1,xB〉;〈x1,xF〉;〈xC,x7〉;〈xF,x1〉;〈x7,xC〉;〈x9,x1〉;〈x5,xD〉;〈x3,x2〉;〈xD,x9〉;〈xD,x6〉;〈xE,xA〉;〈x0,x6〉 ]. - -ndefinition dTest_random_ex53 ≝ -[〈x5,xB〉;〈x6,x9〉;〈x6,xB〉;〈xA,xC〉;〈x0,x9〉;〈x1,x6〉;〈xA,x3〉;〈xC,xA〉;〈x8,xE〉;〈x8,x3〉;〈x3,x4〉;〈xB,x7〉;〈x4,x1〉;〈x2,x7〉;〈xB,x3〉;〈x0,x1〉 -;〈xE,x6〉;〈x0,x6〉;〈x8,xC〉;〈x0,x4〉;〈x3,xD〉;〈xB,xE〉;〈x2,xC〉;〈x6,x6〉;〈xB,x5〉;〈x8,x6〉;〈x1,x1〉;〈x1,x3〉;〈x6,xD〉;〈xD,x0〉;〈xB,xE〉;〈x8,xD〉 ]. - -ndefinition dTest_random_ex54 ≝ -[〈xC,x7〉;〈x5,x5〉;〈x0,x2〉;〈xC,x1〉;〈x7,x6〉;〈x5,xF〉;〈x2,x0〉;〈x5,xE〉;〈xE,x4〉;〈x3,xE〉;〈x7,x7〉;〈xE,x1〉;〈x3,xF〉;〈xE,x8〉;〈x6,xC〉;〈x4,xA〉 -;〈xA,x0〉;〈xF,xE〉;〈xC,xE〉;〈x3,xF〉;〈x6,x7〉;〈x9,x4〉;〈x3,xF〉;〈xE,xF〉;〈xE,xF〉;〈x8,x6〉;〈xD,x9〉;〈x4,xA〉;〈x0,x8〉;〈x8,xB〉;〈xC,x8〉;〈x1,xC〉 ]. - -ndefinition dTest_random_ex55 ≝ -[〈xA,xD〉;〈x2,x0〉;〈xA,x7〉;〈x8,xC〉;〈x0,x6〉;〈x6,x7〉;〈xA,xF〉;〈x7,x3〉;〈xC,xD〉;〈x1,x6〉;〈x8,x4〉;〈x3,x2〉;〈xD,x0〉;〈xF,x3〉;〈xD,xC〉;〈xD,xB〉 -;〈xB,x7〉;〈x2,x4〉;〈x6,xA〉;〈x6,x3〉;〈x1,xC〉;〈xA,x1〉;〈xD,xE〉;〈xB,xC〉;〈x9,x2〉;〈xF,x1〉;〈x5,xC〉;〈xE,x7〉;〈xE,x0〉;〈xD,x5〉;〈xA,x4〉;〈x4,xA〉 ]. - -ndefinition dTest_random_ex56 ≝ -[〈x0,x0〉;〈xD,x6〉;〈x2,x2〉;〈x9,xC〉;〈x5,x2〉;〈x8,xF〉;〈xE,x8〉;〈x2,x2〉;〈xA,x2〉;〈xF,x0〉;〈x9,x8〉;〈x3,x8〉;〈x0,xD〉;〈xF,x6〉;〈x4,x3〉;〈x7,x9〉 -;〈x8,x2〉;〈xA,xF〉;〈xD,x5〉;〈xC,x1〉;〈x8,x2〉;〈x5,x2〉;〈xD,xB〉;〈x8,xF〉;〈x7,xE〉;〈xD,x1〉;〈x9,xD〉;〈xA,x6〉;〈x8,xE〉;〈x9,xE〉;〈xA,x9〉;〈x8,xE〉 ]. - -ndefinition dTest_random_ex57 ≝ -[〈xD,x1〉;〈xF,x6〉;〈xB,x0〉;〈xE,xA〉;〈x8,x3〉;〈xE,x9〉;〈xF,x7〉;〈x3,xB〉;〈x4,xA〉;〈x0,x9〉;〈x1,xE〉;〈x3,x2〉;〈xD,x2〉;〈x5,xD〉;〈xD,x7〉;〈xA,xB〉 -;〈x4,xD〉;〈x6,xF〉;〈x5,x9〉;〈xF,xC〉;〈x4,x3〉;〈x4,x1〉;〈x0,x0〉;〈x3,xC〉;〈x9,x4〉;〈x5,x2〉;〈x5,x9〉;〈x6,xC〉;〈x6,xE〉;〈xE,x8〉;〈x6,x6〉;〈xF,x5〉 ]. - -ndefinition dTest_random_ex58 ≝ -[〈x9,xC〉;〈x5,x7〉;〈x6,xC〉;〈xE,x2〉;〈x3,xB〉;〈xA,x2〉;〈x2,x1〉;〈xE,xE〉;〈xF,x6〉;〈x4,xF〉;〈xF,x3〉;〈x6,x2〉;〈xD,xB〉;〈x8,xF〉;〈x6,x4〉;〈xD,x3〉 -;〈x8,x0〉;〈x6,x9〉;〈x9,x7〉;〈x4,x7〉;〈x8,xB〉;〈xB,x6〉;〈x3,x8〉;〈x4,x5〉;〈xB,xE〉;〈x0,xD〉;〈x6,x1〉;〈xC,xF〉;〈x7,x8〉;〈xC,xF〉;〈x4,x1〉;〈x7,xF〉 ]. - -ndefinition dTest_random_ex59 ≝ -[〈xF,x4〉;〈x5,xA〉;〈x8,xB〉;〈x7,x2〉;〈xE,x6〉;〈x7,xD〉;〈x4,xC〉;〈x1,x8〉;〈xE,xE〉;〈x3,xA〉;〈x1,x2〉;〈x9,x4〉;〈x3,x4〉;〈x3,x0〉;〈x3,x9〉;〈x0,x0〉 -;〈x9,x5〉;〈x6,x0〉;〈xF,xA〉;〈x7,xF〉;〈xA,x6〉;〈xC,x7〉;〈xB,x1〉;〈x7,xE〉;〈x0,xD〉;〈x2,x4〉;〈xF,xF〉;〈x4,x3〉;〈x7,x8〉;〈x8,x8〉;〈x6,xC〉;〈x0,x7〉 ]. - -ndefinition dTest_random_ex5A ≝ -[〈x7,x3〉;〈x9,x2〉;〈xC,x8〉;〈x0,xB〉;〈x5,x0〉;〈x9,x7〉;〈xF,x4〉;〈x1,xB〉;〈xD,xB〉;〈x4,x5〉;〈x6,x2〉;〈x9,x1〉;〈x8,x7〉;〈x5,xD〉;〈xF,x5〉;〈x6,x1〉 -;〈x3,x8〉;〈xF,x3〉;〈x8,xA〉;〈x4,xF〉;〈xD,xB〉;〈x3,xD〉;〈x4,x3〉;〈x2,xF〉;〈xB,xA〉;〈xA,x9〉;〈xB,x4〉;〈xA,x9〉;〈x2,x6〉;〈x7,xE〉;〈x8,xC〉;〈x1,x6〉 ]. - -ndefinition dTest_random_ex5B ≝ -[〈xF,xC〉;〈x1,xC〉;〈xA,x7〉;〈x9,xD〉;〈x7,xC〉;〈x8,x5〉;〈xA,x7〉;〈x3,x5〉;〈x8,x6〉;〈x4,xF〉;〈xC,x8〉;〈x9,xA〉;〈x0,xD〉;〈x2,x4〉;〈x0,x4〉;〈x5,x8〉 -;〈x4,x2〉;〈x3,x0〉;〈x7,x5〉;〈x8,xD〉;〈xB,xC〉;〈x7,x2〉;〈x3,x4〉;〈xF,x9〉;〈x4,x6〉;〈x5,xE〉;〈xF,x4〉;〈x5,xC〉;〈x6,x7〉;〈x0,x4〉;〈x8,x8〉;〈x2,x8〉 ]. - -ndefinition dTest_random_ex5C ≝ -[〈xA,x9〉;〈xE,xC〉;〈xE,xC〉;〈x7,xC〉;〈x4,x6〉;〈x6,xE〉;〈x1,xC〉;〈xD,x9〉;〈xC,x0〉;〈x6,x1〉;〈x5,x8〉;〈x5,xE〉;〈x3,x7〉;〈xB,x0〉;〈x9,x9〉;〈x9,x7〉 -;〈xA,x0〉;〈x9,xB〉;〈x7,x7〉;〈x4,xA〉;〈xD,x0〉;〈xB,x5〉;〈x1,xD〉;〈xA,x6〉;〈x4,xA〉;〈xC,x5〉;〈x3,xA〉;〈x9,x4〉;〈xB,x4〉;〈x5,x0〉;〈x0,x6〉;〈xC,x0〉 ]. - -ndefinition dTest_random_ex5D ≝ -[〈xA,x8〉;〈x0,x2〉;〈x5,xF〉;〈x0,xE〉;〈x2,x1〉;〈x0,x3〉;〈xB,x1〉;〈x9,x6〉;〈x0,x2〉;〈x9,x7〉;〈x8,x0〉;〈x1,xA〉;〈x0,xB〉;〈x3,xD〉;〈x2,x1〉;〈x7,xF〉 -;〈x0,x3〉;〈x2,x9〉;〈x3,x2〉;〈x6,x6〉;〈xB,xF〉;〈x3,xB〉;〈x5,x7〉;〈x5,x3〉;〈xE,x7〉;〈xD,x5〉;〈xE,x5〉;〈x4,x5〉;〈xA,x3〉;〈x1,xA〉;〈x1,xB〉;〈xF,x8〉 ]. - -ndefinition dTest_random_ex5E ≝ -[〈xC,xF〉;〈xB,x3〉;〈x9,x5〉;〈x5,x9〉;〈x4,xE〉;〈x6,x4〉;〈x4,x3〉;〈xF,x4〉;〈x2,x5〉;〈xC,xC〉;〈x6,x1〉;〈x3,x5〉;〈xD,xF〉;〈x3,x6〉;〈x5,x5〉;〈xC,xF〉 -;〈x9,xA〉;〈x1,x1〉;〈xF,x6〉;〈xD,x4〉;〈x4,xF〉;〈x9,xB〉;〈xA,xF〉;〈xF,x2〉;〈x0,x3〉;〈x1,x9〉;〈x9,xB〉;〈xA,xB〉;〈xC,x4〉;〈x1,x9〉;〈xA,x1〉;〈xE,xA〉 ]. - -ndefinition dTest_random_ex5F ≝ -[〈x1,xB〉;〈x2,x5〉;〈xA,xD〉;〈xA,xA〉;〈x0,x0〉;〈x5,xB〉;〈x9,xD〉;〈x6,xF〉;〈x8,x8〉;〈x6,xF〉;〈x3,x0〉;〈x8,x5〉;〈xC,x6〉;〈x1,x7〉;〈x5,x7〉;〈x1,x1〉 -;〈xA,xB〉;〈x0,x2〉;〈xD,xD〉;〈x9,x2〉;〈x4,xD〉;〈x8,x2〉;〈x0,x2〉;〈x3,x5〉;〈xC,xB〉;〈x4,x4〉;〈xA,x4〉;〈x4,x1〉;〈xD,x5〉;〈x1,x2〉;〈xE,x7〉;〈x4,xD〉 ]. - -ndefinition dTest_random_32 ≝ - dTest_random_ex00. - -ndefinition dTest_random_64 ≝ - dTest_random_32@dTest_random_ex01. - -ndefinition dTest_random_128 ≝ - dTest_random_64@dTest_random_ex02@dTest_random_ex03. - -ndefinition dTest_random_256 ≝ - dTest_random_128@ - dTest_random_ex04@dTest_random_ex05@dTest_random_ex06@dTest_random_ex07. - -ndefinition dTest_random_512 ≝ - dTest_random_256@ - dTest_random_ex08@dTest_random_ex09@dTest_random_ex0A@dTest_random_ex0B@ - dTest_random_ex0C@dTest_random_ex0D@dTest_random_ex0E@dTest_random_ex0F. - -ndefinition dTest_random_1024 ≝ - dTest_random_512@ - dTest_random_ex10@dTest_random_ex11@dTest_random_ex12@dTest_random_ex13@ - dTest_random_ex14@dTest_random_ex15@dTest_random_ex16@dTest_random_ex17@ - dTest_random_ex18@dTest_random_ex19@dTest_random_ex1A@dTest_random_ex1B@ - dTest_random_ex1C@dTest_random_ex1D@dTest_random_ex1E@dTest_random_ex1F. - -ndefinition dTest_random_2048 ≝ - dTest_random_1024@ - dTest_random_ex20@dTest_random_ex21@dTest_random_ex22@dTest_random_ex23@ - dTest_random_ex24@dTest_random_ex25@dTest_random_ex26@dTest_random_ex27@ - dTest_random_ex28@dTest_random_ex29@dTest_random_ex2A@dTest_random_ex2B@ - dTest_random_ex2C@dTest_random_ex2D@dTest_random_ex2E@dTest_random_ex2F@ - dTest_random_ex30@dTest_random_ex31@dTest_random_ex32@dTest_random_ex33@ - dTest_random_ex34@dTest_random_ex35@dTest_random_ex36@dTest_random_ex37@ - dTest_random_ex38@dTest_random_ex39@dTest_random_ex3A@dTest_random_ex3B@ - dTest_random_ex3C@dTest_random_ex3D@dTest_random_ex3E@dTest_random_ex3F. - -ndefinition dTest_random_3072 ≝ - dTest_random_2048@ - dTest_random_ex40@dTest_random_ex41@dTest_random_ex42@dTest_random_ex43@ - dTest_random_ex44@dTest_random_ex45@dTest_random_ex46@dTest_random_ex47@ - dTest_random_ex48@dTest_random_ex49@dTest_random_ex4A@dTest_random_ex4B@ - dTest_random_ex4C@dTest_random_ex4D@dTest_random_ex4E@dTest_random_ex4F@ - dTest_random_ex50@dTest_random_ex51@dTest_random_ex52@dTest_random_ex53@ - dTest_random_ex54@dTest_random_ex55@dTest_random_ex56@dTest_random_ex57@ - dTest_random_ex58@dTest_random_ex59@dTest_random_ex5A@dTest_random_ex5B@ - dTest_random_ex5C@dTest_random_ex5D@dTest_random_ex5E@dTest_random_ex5F. - -(* campitura di 128 0x00 *) -ndefinition dTest_bytes_aux : list byte8 ≝ -[ -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉; -〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉;〈x0,x0〉 -]. - -(* blocco di 0x00 lungo 0x0380 da caricare dopo dati per azzerare - counters, index, position, e stack di esecuzione *) -ndefinition dTest_zeros : list byte8 ≝ - dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux. - -ndefinition dTest_zeros3K : list byte8 ≝ - dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@ - dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@ - dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@ - dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux@dTest_bytes_aux. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests1.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests1.ma deleted file mode 100755 index 1535d4349..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests1.ma +++ /dev/null @@ -1,143 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ********* *) -(* HCS08 ADC *) -(* ********* *) - -ndefinition mTest_HCS08_ADC_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di ADC e le modalita' IMM1,DIR1/2,IX0/1/2,SP1/2 *) -(* BEFORE: A=0x00 H:X=0xFF50 PC=0x1860 SP=0x0110 C=true *) -(* [0x1860] 2clk *) (compile m ? ADC (maIMM1 〈xA,xA〉) I) @ (* AFTER1: imm1=0xAA quindi 0x00+imm1+true=A:0xAB C:false *) -(* [0x1862] 3clk *) (compile m ? ADC (maDIR1 〈xF,xF〉) I) @ (* AFTER2: dir1=[0x00FF]=0x8F quindi 0xAB+dir1+false=A:0x3A C:true *) -(* [0x1864] 4clk *) (compile m ? ADC (maDIR2 〈〈xF,xF〉:〈x1,x1〉〉) I) @ (* AFTER3: dir2=[0xFF11]=0x11 quindi 0x3A+dir2+true=A:0x4C C:false *) -(* [0x1867] 4clk *) (compile m ? ADC (maIX2 〈〈xF,xF〉:〈xF,x0〉〉) I) @ (* AFTER4: ix2=[X+0xFFF0]=[0xFF40]=0x40 quindi 0x4C+ix2+false=A:0x8C C:false *) -(* [0x186A] 3clk *) (compile m ? ADC (maIX1 〈x2,x4〉) I) @ (* AFTER5: ix1=[X+0x0024]=[0xFF74]=0x74 quindi 0x8C+ix1+false=A:0x00 C:true *) -(* [0x186C] 3clk *) (compile m ? ADC maIX0 I) @ (* AFTER6: ix0=[X]=[0xFF50]=0x50 quindi 0x00+ix0+true=A:0x51 C:false *) -(* [0x186D] 5clk *) (compile m ? ADC (maSP2 〈〈xF,xF〉:〈x6,x1〉〉) I) @ (* AFTER7: sp2=[SP+0xFF61]=[0x0071]=0x01 quindi 0x51+sp2+false=A:0x52 C:false *) -(* [0x1871] 4clk *) (compile m ? ADC (maSP1 〈x2,x4〉) I) (* AFTER8: sp1=[SP+0x0024]=[0x0134]=0xC4 quindi 0x52+sp1+false=A:0x16 C:true *) -(* [0x1874] si puo' quindi enunciare che dopo 2+3+4+4+3+3+5+4=28 clk *) -(* A<-0x16 PC<-0x1874 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_ADC_status ≝ -λt:memory_impl. - set_c_flag HCS08 t (* C<-true *) - (setweak_sp_reg HCS08 t (* SP<-0x0110 *) - (setweak_indX_16_reg HCS08 t (* H:X<-0xFF50 *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (* carica mTest_bytes in ROM:mTest_HCS08_data *) - (load_from_source_at t (* carica mTest_bytes in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_ADC_source mTest_HCS08_prog) - mTest_bytes mTest_HCS08_RAM) - mTest_bytes mTest_HCS08_data) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - (mk_word16 〈xF,xF〉 〈x5,x0〉)) - (mk_word16 〈x0,x1〉 〈x1,x0〉)) - true. - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_HCS08_ADC_full : - ∀t:memory_impl. - execute HCS08 t (TickOK ? (mTest_HCS08_ADC_status t)) nat28 = - (* NB: V,N,Z sono tornati false C e' tornato true *) - TickOK ? (set_pc_reg HCS08 t (* nuovo PC *) - (set_acc_8_low_reg HCS08 t (mTest_HCS08_ADC_status t) 〈x1,x6〉) (* nuovo A *) - (mk_word16 〈x1,x8〉 〈x7,x4〉)). - #t; nelim t; - (* esempio per svoglimento degli stati manualmente - [ 1: - letin BEFORE ≝ (get_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC)); - normalize in BEFORE:(%); - - letin AFTER_ALU1 ≝ (match execute HCS08 MEM_FUNC (TickOK ? (mTest_HCS08_ADC_status MEM_FUNC)) 2 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU1:(%); - - letin AFTER_ALU2 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU1)) 3 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU2:(%); - - letin AFTER_ALU3 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU2)) 4 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU3:(%); - - letin AFTER_ALU4 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU3)) 4 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU4:(%); - - letin AFTER_ALU5 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU4)) 3 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU5:(%); - - letin AFTER_ALU6 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU5)) 3 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU6:(%); - - letin AFTER_ALU7 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU6)) 5 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU7:(%); - - letin AFTER_ALU8 ≝ (match execute HCS08 MEM_FUNC (TickOK ? - (set_alu HCS08 MEM_FUNC (mTest_HCS08_ADC_status MEM_FUNC) AFTER_ALU7)) 4 with - [ TickERR _ _ ⇒ BEFORE - | TickSUSP _ _ ⇒ BEFORE - | TickOK s ⇒ get_alu HCS08 MEM_FUNC s ]); - normalize in AFTER_ALU8:(%); *) - - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests10.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests10.ma deleted file mode 100755 index c9b6576aa..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests10.ma +++ /dev/null @@ -1,103 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ************************ *) -(* TEST SU GRANULARITA' BIT *) -(* ************************ *) - -ndefinition mTest_bits_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* BEFORE: va a testare [0x0070]=0x00 *) -(* [0x1860] 4clk *) (compile m ? MOV (maIMM1_to_DIR1 〈xF,xF〉 〈x7,x0〉) I) -(* [0x1863] *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_bits_status ≝ -λt:memory_impl. -λsub:oct. -λb:byte8. - setweak_n_flag HCS08 t (* N<-1 *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t - (load_from_source_at t (zero_memory t) (* carica b in RAM:mTest_HCS08_RAM *) - mTest_bits_source mTest_HCS08_prog) (* carica source in ROM:mTest_HCS08_prog *) - [ b ] mTest_HCS08_RAM) - (check_update_bit t (* setta mTest_HCS08_RAM,o come ROM *) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - mTest_HCS08_RAM sub MEM_READ_ONLY) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - true. - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_bits_MEM_BITS_full : - ∀sub:oct. - execute HCS08 MEM_BITS (TickOK ? (mTest_bits_status MEM_BITS sub 〈x0,x0〉)) nat4 = - TickOK ? (set_pc_reg HCS08 MEM_BITS (mTest_bits_status MEM_BITS sub (byte8_of_bits (setn_array8T sub ? (bits_of_byte8 〈xF,xF〉) false))) (* nuovo PC *) - (mk_word16 〈x1,x8〉 〈x6,x3〉)). - #sub; nelim sub; - napply refl_eq. -nqed. - -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -nlemma ok_mTest_bits_MEM_FUNC_full : -∀sub:oct. - eq_anystatus HCS08 MEM_FUNC - (match execute HCS08 MEM_FUNC (TickOK ? (mTest_bits_status MEM_FUNC sub 〈x0,x0〉)) nat4 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 MEM_FUNC (mTest_bits_status MEM_FUNC sub 〈xF,xF〉) (* nuovo PC *) 〈〈x1,x8〉:〈x6,x3〉〉) - [ 〈〈x0,x0〉:〈x7,x0〉〉 ] = true. - #sub; nelim sub; - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x7,x0〉〉 ] HCS08 MEM_FUNC - (match execute HCS08 MEM_FUNC (TickOK ? (mTest_bits_status MEM_FUNC sub 〈x0,x0〉)) nat4 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 MEM_FUNC (mTest_bits_status MEM_FUNC sub 〈xF,xF〉) (* nuovo PC *) 〈〈x1,x8〉:〈x6,x3〉〉)); - nnormalize in ⊢ (? ? ? %); - napply refl_eq. -nqed. - -nlemma ok_mTest_bits_MEM_TREE_full : -∀sub:oct. - eq_anystatus HCS08 MEM_TREE - (match execute HCS08 MEM_TREE (TickOK ? (mTest_bits_status MEM_TREE sub 〈x0,x0〉)) nat4 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 MEM_TREE (mTest_bits_status MEM_TREE sub 〈xF,xF〉) (* nuovo PC *) 〈〈x1,x8〉:〈x6,x3〉〉) - [ 〈〈x0,x0〉:〈x7,x0〉〉 ] = true. - #sub; nelim sub; - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x7,x0〉〉 ] HCS08 MEM_TREE - (match execute HCS08 MEM_TREE (TickOK ? (mTest_bits_status MEM_TREE sub 〈x0,x0〉)) nat4 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 MEM_TREE (mTest_bits_status MEM_TREE sub 〈xF,xF〉) (* nuovo PC *) 〈〈x1,x8〉:〈x6,x3〉〉)); - nnormalize in ⊢ (? ? ? %); - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests2.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests2.ma deleted file mode 100755 index d7515db8b..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests2.ma +++ /dev/null @@ -1,87 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ********* *) -(* HCS08 MOV *) -(* ********* *) - -ndefinition mTest_HCS08_MOV_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di MOV e le modalita' xxx_to_xxx *) -(* BEFORE: H:X=0x0071 PC=0x1860 *) -(* [0x1860] 4clk *) (compile m ? MOV (maIMM1_to_DIR1 〈x3,xA〉 〈x7,x0〉) I) @ (* 0x3A in [0x0070] *) -(* [0x1863] 5clk *) (compile m ? MOV (maDIR1_to_DIR1 〈x7,x0〉 〈x7,x1〉) I) @ (* [0x0070] in [0x0071] *) -(* [0x1866] 5clk *) (compile m ? MOV (maIX0p_to_DIR1 〈x7,x2〉) I) @ (* [X++=0x0071] in [0x0072] *) -(* [0x1868] 5clk *) (compile m ? MOV (maDIR1_to_IX0p 〈x7,x2〉) I) (* [0x0072] in [X++=0x0072] *) -(* [0x186A] si puo' quindi enunciare che dopo 4+5+5+5=19 clk *) -(* PC<-0x186A X<-0x0073 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_MOV_status ≝ -λt:memory_impl. -λb1,b2,b3:byte8. - setweak_indX_16_reg HCS08 t (* H:X<-0x0071 *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (* carica b1-3 in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_MOV_source mTest_HCS08_prog) - [ b1 ; b2 ; b3 ] mTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - (mk_word16 〈x0,x0〉 〈x7,x1〉). - -(* dimostrazione senza svolgimento degli stati, immediata *) -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -nlemma ok_mTest_HCS08_MOV_full : -∀t:memory_impl. - eq_anystatus HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_MOV_status t 〈x0,x0〉 〈x0,x0〉 〈x0,x0〉)) nat19 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (setweak_indX_16_reg HCS08 t (* H:X *) - (set_pc_reg HCS08 t (mTest_HCS08_MOV_status t 〈x3,xA〉 〈x3,xA〉 〈x3,xA〉) (* PC *) - (mk_word16 〈x1,x8〉 〈x6,xA〉)) - (mk_word16 〈x0,x0〉 〈x7,x3〉)) - [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] = true. - #t; - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_MOV_status t 〈x0,x0〉 〈x0,x0〉 〈x0,x0〉)) nat19 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (setweak_indX_16_reg HCS08 t (* H:X *) - (set_pc_reg HCS08 t (mTest_HCS08_MOV_status t 〈x3,xA〉 〈x3,xA〉 〈x3,xA〉) (* PC *) - (mk_word16 〈x1,x8〉 〈x6,xA〉)) - (mk_word16 〈x0,x0〉 〈x7,x3〉))); - nelim t; - nnormalize in ⊢ (? ? ? %); - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests3.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests3.ma deleted file mode 100755 index 71bd37984..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests3.ma +++ /dev/null @@ -1,76 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ************* *) -(* HCS08 ROL/ROR *) -(* ************* *) - -ndefinition mTest_HCS08_ROL_ROR_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di ROL/ROR e le modalita' IMM2,INHx *) -(* BEFORE: A=0x00 H:X=0x0000 PC=0x1860 Z=true *) -(* [0x1860] 3clk *) (compile m ? LDHX (maIMM2 〈〈x1,x2〉:〈x3,x4〉〉) I) @ -(* [0x1863] 2clk *) (compile m ? LDA (maIMM1 〈x5,x6〉) I) @ -(* [0x1865] 1clk *) (compile m ? ROL maINHA I) @ -(* [0x1866] 1clk *) (compile m ? ROL maINHX I) @ -(* [0x1867] 1clk *) (compile m ? ROR maINHA I) @ -(* [0x1868] 1clk *) (compile m ? ROR maINHX I) @ -(* [0x1869] 1clk *) (compile m ? CLR maINHA I) @ -(* [0x186A] 1clk *) (compile m ? CLR maINHX I) @ -(* [0x186B] 1clk *) (compile m ? CLR maINHH I) -(* [0x186C] si puo' quindi enunciare che dopo 3+2+1+1+1+1+1+1+1=12 clk *) -(* PC<-0x186C *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_ROL_ROR_status ≝ -λt:memory_impl. - set_z_flag HCS08 t (* Z<-true *) - (setweak_indX_16_reg HCS08 t (* H:X<-0x0000 *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_ROL_ROR_source mTest_HCS08_prog) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x0 x0))) - true. - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_HCS08_ROL_ROR_full : - ∀t:memory_impl. - execute HCS08 t (TickOK ? (mTest_HCS08_ROL_ROR_status t)) nat12 = - TickOK ? (set_pc_reg HCS08 t (* nuovo PC *) - (mTest_HCS08_ROL_ROR_status t) (mk_word16 〈x1,x8〉 〈x6,xC〉)). - #t; nelim t; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4.ma deleted file mode 100755 index c2f055c70..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4.ma +++ /dev/null @@ -1,152 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* **************** *) -(* HCS08 CBEQx/DBNZ *) -(* **************** *) - -ndefinition mTest_HCS08_CBEQ_DBNZ_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di CBEQx/DBNZ e le modalita' xxx_and_IMM1 *) -(* BEFORE: H:X=0x006F SP=0x006F PC=0x1860 *) -(* [0x1860] 5clk *) (compile m ? CBEQA (maDIR1_and_IMM1 〈x7,x1〉 〈x0,x1〉) I) @ -(* [0x1863] 1clk *) (compile m ? NOP maINH I) @ (* eseguito: A≠[0x0071]=0x01 *) -(* [0x1864] 4clk *) (compile m ? CBEQA (maIMM1_and_IMM1 〈x0,x0〉 〈x0,x1〉) I) @ -(* [0x1867] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: A=0x00 *) -(* [0x1868] 4clk *) (compile m ? CBEQX (maIMM1_and_IMM1 〈x6,xF〉 〈x0,x1〉) I) @ -(* [0x186B] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: X=0x6F *) -(* [0x186C] 5clk *) (compile m ? CBEQA (maIX1p_and_IMM1 〈x0,x1〉 〈x0,x1〉) I) @ (* H:X++ *) -(* [0x186F] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: A=[X+0x01]=[0x0070]=0x00 *) -(* [0x1870] 5clk *) (compile m ? CBEQA (maIX0p_and_IMM1 〈x0,x1〉) I) @ (* H:X++ *) -(* [0x1872] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: A=[X]=[0x0070]=0x00 *) -(* [0x1873] 6clk *) (compile m ? CBEQA (maSP1_and_IMM1 〈x0,x2〉 〈x0,x1〉) I) @ -(* [0x1877] 1clk *) (compile m ? NOP maINH I) @ (* eseguito: A≠[SP+0x02]=[0x0071]=0x01 *) - -(* [0x1878] 7clk *) (compile m ? DBNZ (maDIR1_and_IMM1 〈x7,x2〉 〈x0,x1〉) I) @ -(* [0x187B] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: --[0x0072]=0x01≠0 *) -(* [0x187C] 4clk *) (compile m ? DBNZ (maINHA_and_IMM1 〈x0,x1〉) I) @ -(* [0x187E] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: --A=0xFF≠0 *) -(* [0x187F] 4clk *) (compile m ? DBNZ (maINHX_and_IMM1 〈x0,x1〉) I) @ -(* [0x1881] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: --X=0x70≠0 *) -(* [0x1882] 7clk *) (compile m ? DBNZ (maIX1_and_IMM1 〈x0,x2〉 〈x0,x1〉) I) @ -(* [0x1885] 1clk *) (compile m ? NOP maINH I) @ (* eseguito: --[X+0x02]=[0x0072]=0x00=0 *) -(* [0x1886] 6clk *) (compile m ? DBNZ (maIX0_and_IMM1 〈x0,x1〉) I) @ -(* [0x1888] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: --[X]=[0x0070]=0xFF≠0 *) -(* [0x1889] 8clk *) (compile m ? DBNZ (maSP1_and_IMM1 〈x0,x1〉 〈x0,x1〉) I) @ -(* [0x188D] 1clk *) (compile m ? NOP maINH I) (* non eseguito: --[SP+0x01]=[0x0070]=0xFE≠0 *) -(* [0x188E] si puo' quindi enunciare che dopo 5+1+4+4+5+5+6+1 (31) - 7+4+4+7+1+6+8 (37) =68 clk *) -(* A<-0xFF PC<-0x188E H:X<-0070 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_CBEQ_DBNZ_status ≝ -λt:memory_impl. -λb1,b2,b3:byte8. - setweak_sp_reg HCS08 t (* SP<-0x006F *) - (setweak_indX_16_reg HCS08 t (* H:X<-0x006F *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (* carica b1-3 in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (* carica mTest_bytes in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_CBEQ_DBNZ_source mTest_HCS08_prog) - mTest_bytes mTest_HCS08_RAM) - [ b1 ; b2 ; b3 ] mTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x6 xF))) - (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x6 xF)). - -(* dimostrazione senza svolgimento degli stati, immediata *) -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -nlemma ok_mTest_HCS08_CBEQ_DBNZ_full : -∀t:memory_impl. - eq_anystatus HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_CBEQ_DBNZ_status t 〈x0,x0〉 〈x0,x1〉 〈x0,x2〉)) nat68 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_acc_8_low_reg HCS08 t (* nuovo A *) - (set_pc_reg HCS08 t (* nuovo PC *) - (setweak_indX_16_reg HCS08 t (mTest_HCS08_CBEQ_DBNZ_status t 〈xF,xE〉 〈x0,x1〉 〈x0,x0〉) (* nuovo H:X *) - (mk_word16 〈x0,x0〉 〈x7,x0〉)) - (mk_word16 〈x1,x8〉 〈x8,xE〉)) - (mk_byte8 xF xF)) - [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] = true. - #t; - - (* nelim t; napply refl_eq; *) - (* cosi' in 7sec fa tutto *) - - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] HCS08 t …); - ##[ ##3: (* ram *) - nelim t; - nnormalize in ⊢ (? ? % ?); - napply refl_eq; - (* 10sec con normalize, leggermente di piu' senza *) - ##| ##2: (* descrittore *) - nelim t; - nnormalize in ⊢ (? ? ? %); - nnormalize in ⊢ (? ? % ?); - napply refl_eq; - (* 7sec con normalize, leggermente di piu' senza il secondo normalize, - non termina senza il primo *) - ##| ##1: (* alu *) - nelim t; - (* senza questo normalize non va nulla *) - ##[ ##2,3: nnormalize in ⊢ (? ? ? %); - napply refl_eq; - ##| ##1: (* in questo punto si vede benissimo come stato1 = stato2 esplode - mentre la trasformazione eq_stato s1 s2 = true computa benissimo *) - (* un napply refl_eq diretto non ci riesce proprio... *) - napply (eqaluHC08_to_eq - (alu HCS08 MEM_FUNC (match execute HCS08 MEM_FUNC (TickOK ? (mTest_HCS08_CBEQ_DBNZ_status MEM_FUNC 〈x0,x0〉 〈x0,x1〉 〈x0,x2〉)) nat68 with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ])) - (alu HCS08 MEM_FUNC (set_acc_8_low_reg HCS08 MEM_FUNC (* nuovo A *) - (set_pc_reg HCS08 MEM_FUNC (* nuovo PC *) - (setweak_indX_16_reg HCS08 MEM_FUNC (mTest_HCS08_CBEQ_DBNZ_status MEM_FUNC 〈xF,xE〉 〈x0,x1〉 〈x0,x0〉) (* nuovo H:X *) - (mk_word16 〈x0,x0〉 〈x7,x0〉)) (mk_word16 〈x1,x8〉 〈x8,xE〉)) (mk_byte8 xF xF))) - ?); - nnormalize in ⊢ (? ? % ?); - napply refl_eq; - ##] - ##] -(* pero' ora si e' inceppato nqed... *) -nqed. - -(* IMPRESSIONI - sembra confermato ora che un confronto diretto "oggettoGrosso1 = oggettoGrosso2" fallisca - mentre "funzione_eq oggettoGrosso1 oggettoGrosso2 = const." riesce - - lo si vede in "forall_memory_ranged mem1 mem2 [addr] = true" - lo si vede in "get_clk (...) = const." NB: senza il normalize dx. infatti fallisce... - lo si vede in "alu1 = alu2" che fallisce stranamente solo nel caso MEM_FUNC - riportare "alu1 = alu2" a "eq alu1 alu2 = true" col teorema lo aggira, ma non chiude nqed -*) diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4bis.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4bis.ma deleted file mode 100755 index cb3844651..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests4bis.ma +++ /dev/null @@ -1,89 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* **************** *) -(* HCS08 CBEQx/DBNZ *) -(* **************** *) - -ndefinition mTest_HCS08_CBEQ_DBNZ_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di CBEQx/DBNZ e le modalita' xxx_and_IMM1 *) -(* BEFORE: H:X=0x006F SP=0x006F PC=0x1860 *) -(* [0x1860] 5clk *) (compile m ? CBEQA (maDIR1_and_IMM1 〈x7,x1〉 〈x0,x1〉) I) @ -(* [0x1863] 1clk *) (compile m ? NOP maINH I) @ (* eseguito: A≠[0x0071]=0x01 *) -(* [0x1864] 4clk *) (compile m ? CBEQA (maIMM1_and_IMM1 〈x0,x0〉 〈x0,x1〉) I) @ -(* [0x1867] 1clk *) (compile m ? NOP maINH I) @ (* non eseguito: A=0x00 *) -(* [0x1868] 4clk *) (compile m ? CBEQX (maIMM1_and_IMM1 〈x6,xF〉 〈x0,x1〉) I) @ -(* [0x186B] 1clk *) (compile m ? NOP maINH I) (* non eseguito: X=0x6F *) -(* [0x186C] si puo' quindi enunciare che dopo 5+1+4+4 =14 *) -(* PC<-0x186C H:X<-006F *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_CBEQ_DBNZ_status ≝ -λt:memory_impl. -λb1,b2,b3:byte8. - setweak_sp_reg HCS08 t (* SP<-0x006F *) - (setweak_indX_16_reg HCS08 t (* H:X<-0x006F *) - (set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (* carica b1-3 in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (* carica mTest_bytes in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_CBEQ_DBNZ_source mTest_HCS08_prog) - mTest_bytes mTest_HCS08_RAM) - [ b1 ; b2 ; b3 ] mTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog) - (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x6 xF))) - (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x6 xF)). - -(* dimostrazione senza svolgimento degli stati, immediata *) -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -nlemma ok_mTest_HCS08_CBEQ_DBNZ_full : -∀t:memory_impl. - eq_anystatus HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_CBEQ_DBNZ_status t 〈x0,x0〉 〈x0,x1〉 〈x0,x2〉)) nat14 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 t (* nuovo PC *) - (mTest_HCS08_CBEQ_DBNZ_status t 〈x0,x0〉 〈x0,x1〉 〈x0,x2〉) (* nuovo H:X *) - (mk_word16 〈x1,x8〉 〈x6,xC〉)) - [] = true. - #t; - - (* nelim t; napply refl_eq; nqed. *) - (* cosi' in 3sec fa tutto *) - - napply (eq_to_eqanystatus_weak [] HCS08 t …); - nelim t; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests5.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests5.ma deleted file mode 100755 index 09daf6a72..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests5.ma +++ /dev/null @@ -1,93 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ***************** *) -(* HCS08 BSETn/BCLRn *) -(* ***************** *) - -ndefinition mTest_HCS08_BSETn_BCLRn_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di BSETn/BCLRn e le modalita' DIRn *) -(* BEFORE: PC=0x1860 *) -(* [0x1860] 5clk *) (compile m ? BSETn (maDIRn o0 〈x7,x0〉) I) @ (* [0x0070]=0x01 *) -(* [0x1862] 5clk *) (compile m ? BSETn (maDIRn o1 〈x7,x0〉) I) @ (* [0x0070]=0x03 *) -(* [0x1864] 5clk *) (compile m ? BSETn (maDIRn o2 〈x7,x0〉) I) @ (* [0x0070]=0x07 *) -(* [0x1866] 5clk *) (compile m ? BSETn (maDIRn o3 〈x7,x0〉) I) @ (* [0x0070]=0x0F *) -(* [0x1868] 5clk *) (compile m ? BSETn (maDIRn o4 〈x7,x0〉) I) @ (* [0x0070]=0x1F *) -(* [0x186A] 5clk *) (compile m ? BSETn (maDIRn o5 〈x7,x0〉) I) @ (* [0x0070]=0x3F *) -(* [0x186C] 5clk *) (compile m ? BSETn (maDIRn o6 〈x7,x0〉) I) @ (* [0x0070]=0x7F *) -(* [0x186E] 5clk *) (compile m ? BSETn (maDIRn o7 〈x7,x0〉) I) @ (* [0x0070]=0xFF *) - -(* [0x1870] 5clk *) (compile m ? BCLRn (maDIRn o0 〈x7,x0〉) I) @ (* [0x0070]=0xFE *) -(* [0x1872] 5clk *) (compile m ? BCLRn (maDIRn o1 〈x7,x0〉) I) @ (* [0x0070]=0xFC *) -(* [0x1874] 5clk *) (compile m ? BCLRn (maDIRn o2 〈x7,x0〉) I) @ (* [0x0070]=0xF8 *) -(* [0x1876] 5clk *) (compile m ? BCLRn (maDIRn o3 〈x7,x0〉) I) @ (* [0x0070]=0xF0 *) -(* [0x1878] 5clk *) (compile m ? BCLRn (maDIRn o4 〈x7,x0〉) I) @ (* [0x0070]=0xE0 *) -(* [0x187A] 5clk *) (compile m ? BCLRn (maDIRn o5 〈x7,x0〉) I) @ (* [0x0070]=0xC0 *) -(* [0x187C] 5clk *) (compile m ? BCLRn (maDIRn o6 〈x7,x0〉) I) @ (* [0x0070]=0x80 *) -(* [0x187E] 5clk *) (compile m ? BCLRn (maDIRn o7 〈x7,x0〉) I) (* [0x0070]=0x00 *) -(* [0x1880] si puo' quindi enunciare che dopo 5+5+5+5+5+5+5+5 - 5+5+5+5+5+5+5+5 =80 clk *) -(* PC<-0x1880 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_BSETn_BCLRn_status ≝ -λt:memory_impl. -λb1:byte8. - set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t (* carica b1 in RAM:mTest_HCS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_HCS08_prog *) - mTest_HCS08_BSETn_BCLRn_source mTest_HCS08_prog) - [ b1 ] mTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog. - -(* dimostrazione senza svolgimento degli stati, immediata *) -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -nlemma ok_mTest_HCS08_BSETn_BCLRn_full : -∀t:memory_impl. - eq_anystatus HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_BSETn_BCLRn_status t 〈x0,x0〉)) nat80 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 t (mTest_HCS08_BSETn_BCLRn_status t 〈x0,x0〉) 〈〈x1,x8〉:〈x8,x0〉〉 (* nuovo PC *)) - [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] = true. - #t; - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x7,x0〉〉 ; 〈〈x0,x0〉:〈x7,x1〉〉 ; 〈〈x0,x0〉:〈x7,x2〉〉 ] HCS08 t - (match execute HCS08 t (TickOK ? (mTest_HCS08_BSETn_BCLRn_status t 〈x0,x0〉)) nat80 - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ s ]) - (set_pc_reg HCS08 t (mTest_HCS08_BSETn_BCLRn_status t 〈x0,x0〉) 〈〈x1,x8〉:〈x8,x0〉〉 (* nuovo PC *))); - nelim t; - nnormalize in ⊢ (? ? ? %); - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests6.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests6.ma deleted file mode 100755 index e3437bbfa..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests6.ma +++ /dev/null @@ -1,100 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ******************* *) -(* HCS08 BRSETn/BRCLRn *) -(* ******************* *) - -ndefinition mTest_HCS08_BRSETn_BRCLRn_source ≝ let m ≝ HCS08 in source_to_byte8 m ( -(* testa la logica di BRSETn/BRCLRn e le modalita' DIRn_and_IMM1 *) -(* BEFORE: va a testare [0x00C5]=0x55 PC=0x1860 *) -(* [0x1860] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o0 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1863] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1864] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o1 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1867] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1868] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o2 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x186B] 1clk *) (compile m ? NOP maINH I) @ -(* [0x186C] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o3 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x186F] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1870] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o4 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1873] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1874] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o5 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1877] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1878] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o6 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x187B] 1clk *) (compile m ? NOP maINH I) @ -(* [0x187C] 5clk *) (compile m ? BRSETn (maDIRn_and_IMM1 o7 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x187F] 1clk *) (compile m ? NOP maINH I) @ - -(* [0x1880] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o0 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1883] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1884] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o1 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1887] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1888] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o2 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x188B] 1clk *) (compile m ? NOP maINH I) @ -(* [0x188C] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o3 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x188F] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1890] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o4 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1893] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1894] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o5 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x1897] 1clk *) (compile m ? NOP maINH I) @ -(* [0x1898] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o6 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x189B] 1clk *) (compile m ? NOP maINH I) @ -(* [0x189C] 5clk *) (compile m ? BRCLRn (maDIRn_and_IMM1 o7 〈xC,x5〉 〈x0,x1〉) I) @ -(* [0x189F] 1clk *) (compile m ? NOP maINH I) - -(* [0x18A0] si puo' quindi enunciare che dopo 80+8=88 clk - (vengono eseguiti 16*5 test, meta' BRSETn/BRCLRn saltano *) -(* PC<-0x18A0 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_HCS08_BRSETn_BRCLRn_status ≝ -λt:memory_impl. - set_pc_reg HCS08 t (* PC<-mTest_HCS08_prog *) - (start_of_mcu_version_HCS08 - MC9S08AW60 t - (load_from_source_at t - (load_from_source_at t (zero_memory t) (* carica mTest_bytes in RAM:mTest_HCS08_RAM *) - mTest_HCS08_BRSETn_BRCLRn_source mTest_HCS08_prog) (* carica source in ROM:mTest_HCS08_prog *) - mTest_bytes mTest_HCS08_RAM) - (build_memory_type_of_mcu_version (FamilyHCS08 MC9S08AW60) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false) (* non deterministici tutti a 0 *) - mTest_HCS08_prog. - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_HCS08_BRSETn_BRCLRn_full : - ∀t:memory_impl. - execute HCS08 t (TickOK ? (mTest_HCS08_BRSETn_BRCLRn_status t)) nat88 = - TickOK ? (set_pc_reg HCS08 t (mTest_HCS08_BRSETn_BRCLRn_status t) (* nuovo PC *) - (mk_word16 〈x1,x8〉 〈xA,x0〉)). - #t; nelim t; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests7.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests7.ma deleted file mode 100755 index bd95e2684..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests7.ma +++ /dev/null @@ -1,78 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* *************** *) -(* RS08 X,D[X],TNY *) -(* *************** *) - -ndefinition mTest_RS08_TNY_source ≝ let m ≝ RS08 in source_to_byte8 m ( -(* testa la logica RS08 X,D[X] le modalita' TNY *) -(* NB: il meccanismo utilizzato e' quello complesso dell'RS08 - fare riferimento alle spiegazioni in STATUS/LOAD_WRITE *) -(* X=20 PS=0 *) -(* [0x3800] 3clk *) (compile m ? ADD (maTNY xD) I) @ (* ... +[0x000D]=0x0C *) -(* [0x3801] 3clk *) (compile m ? ADD (maTNY xE) I) @ (* ... +D[X]=[0x0020]=0x1F *) -(* [0x3802] 3clk *) (compile m ? ADD (maTNY xF) I) @ (* ... +X=0x20 *) -(* [0x3803] 3clk *) (compile m ? ADD (maDIR1 〈xC,xF〉) I) @ (* ... +X=0x20 *) -(* [0x3805] 3clk *) (compile m ? ADD (maDIR1 〈xC,xE〉) I) (* ... +[0x000E]=0x0D *) -(* [0x3807] si puo' quindi enunciare che dopo 15 clk - A<-0x78 PC<-0x3807 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_RS08_TNY_status ≝ -λt:memory_impl. - setweak_x_map RS08 t (* X<-0x20 *) - (setweak_ps_map RS08 t (* PS<-0x00 *) - (set_pc_reg RS08 t (* PC<-mTest_RS08_prog *) - (start_of_mcu_version_RS08 - MC9RS08KA2 t - (load_from_source_at t (* carica mTest_bytes in RAM:mTest_RS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_RS08_prog *) - mTest_RS08_TNY_source mTest_RS08_prog) - mTest_bytes 〈〈x0,x0〉:〈x0,x1〉〉) - (build_memory_type_of_mcu_version (FamilyRS08 MC9RS08KA2) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false (* non deterministici tutti a 0 *) - ) mTest_RS08_prog) - (mk_byte8 x0 x0)) - (mk_byte8 x2 x0). - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_RS08_TNY_full : - ∀t:memory_impl. - execute RS08 t (TickOK ? (mTest_RS08_TNY_status t)) nat15 = - TickOK ? (set_acc_8_low_reg RS08 t (* nuovo A *) - (set_pc_reg RS08 t (mTest_RS08_TNY_status t) (* nuovo PC *) - (mk_word16 〈x3,x8〉 〈x0,x7〉)) - (mk_byte8 x7 x8)). - #t; nelim t; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests8.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests8.ma deleted file mode 100755 index fa2b47ff5..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests8.ma +++ /dev/null @@ -1,87 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* *********** *) -(* RS08 PS,SRT *) -(* *********** *) - -ndefinition mTest_RS08_SRT_source ≝ let m ≝ RS08 in source_to_byte8 m ( -(* testa la logica RS08 PS le modalita' SRT *) -(* NB: il meccanismo utilizzato e' quello complesso dell'RS08 - fare riferimento alle spiegazioni in STATUS/LOAD_WRITE *) -(* X=0x1F PS=0xFE Z=1 *) -(* [0x3800] 3clk *) (compile m ? LDA (maSRT t1F) I) @ (* A<-PS *) -(* [0x3801] 2clk *) (compile m ? SUB (maIMM1 〈xF,xE〉) I) @ (* risulta 0 *) -(* [0x3803] 3clk *) (compile m ? BEQ (maIMM1 〈x0,x1〉) I) @ (* salta *) -(* [0x3805] 1clk *) (compile m ? NOP maINH I) @ - -(* [0x3806] 3clk *) (compile m ? LDA (maSRT t0E) I) @ (* A<-PS *) -(* [0x3807] 2clk *) (compile m ? SUB (maIMM1 〈xF,xE〉) I) @ (* risulta 0 *) -(* [0x3809] 3clk *) (compile m ? BEQ (maIMM1 〈x0,x1〉) I) @ (* salta *) -(* [0x380B] 1clk *) (compile m ? NOP maINH I) @ - -(* [0x380C] 3clk *) (compile m ? LDA (maDIR1 〈xC,x3〉) I) @ (* A<-[0x00C3]=[0x3F83]=0x83 *) -(* [0x380E] 2clk *) (compile m ? SUB (maIMM1 〈x8,x3〉) I) @ (* risulta 0 *) -(* [0x3810] 3clk *) (compile m ? BEQ (maIMM1 〈x0,x1〉) I) @ (* salta *) -(* [0x3812] 1clk *) (compile m ? NOP maINH I) -(* [0x3813] si puo' quindi enunciare che dopo 24 clk - PC<-0x3813 *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_RS08_SRT_status ≝ -λt:memory_impl. - setweak_x_map RS08 t (* X<-0x1F *) - (setweak_ps_map RS08 t (* PS<-0xFE *) - (set_z_flag RS08 t (* Z<-true *) - (set_pc_reg RS08 t (* PC<-mTest_RS08_prog *) - (start_of_mcu_version_RS08 - MC9RS08KA2 t - (load_from_source_at t (* carica mTest_bytes in ROM:mTest_RS08_data *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_RS08_prog *) - mTest_RS08_SRT_source mTest_RS08_prog) - mTest_bytes mTest_RS08_data) - (build_memory_type_of_mcu_version (FamilyRS08 MC9RS08KA2) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false (* non deterministici tutti a 0 *) - ) mTest_RS08_prog) - true) - (mk_byte8 xF xE)) - (mk_byte8 x1 xF). - -(* dimostrazione senza svolgimento degli stati, immediata *) -nlemma ok_mTest_RS08_SRT_full : - ∀t:memory_impl. - execute RS08 t (TickOK ? (mTest_RS08_SRT_status t)) nat24 = - TickOK ? (set_pc_reg RS08 t (mTest_RS08_SRT_status t) (* nuovo PC *) - (mk_word16 〈x3,x8〉 〈x1,x3〉)). - #t; nelim t; - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests9.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests9.ma deleted file mode 100755 index 460164abf..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests9.ma +++ /dev/null @@ -1,104 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "freescale_tests/micro_tests_tools.ma". -include "freescale/multivm.ma". -include "freescale/status_lemmas.ma". -include "common/nat_to_num.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* ********************* *) -(* TEOREMA MULT PER RS08 *) -(* ********************* *) - -ndefinition mTest_RS08_mult_source ≝ let m ≝ RS08 in source_to_byte8 m ( -(* - ZH:ZL=X*Y con [0x0020-0x004F] X ≝ [0x0020] Y ≝ [0x0021] ZH ≝ [0x0022] ZL ≝ [0x0023] -*) -(* [0x3800] ZH <- 0 3clk *) (compile m ? CLR (maDIR1 〈x2,x2〉) I) @ -(* [0x3802] ZL <- 0 3clk *) (compile m ? CLR (maDIR1 〈x2,x3〉) I) @ -(* [0x3804] (l1) A <- Y 3clk *) (compile m ? LDA (maDIR1 〈x2,x1〉) I) @ -(* [0x3806] A=0 goto l2 3clk *) (compile m ? BEQ (maIMM1 〈x0,xE〉) I) @ -(* [0x3808] A <- ZL 3clk *) (compile m ? LDA (maDIR1 〈x2,x3〉) I) @ -(* [0x380A] Y -- 5clk *) (compile m ? DEC (maDIR1 〈x2,x1〉) I) @ -(* [0x380C] A += X 3clk *) (compile m ? ADD (maDIR1 〈x2,x0〉) I) @ -(* [0x380E] C=0 goto l3 3clk *) (compile m ? BCC (maIMM1 〈x0,x2〉) I) @ -(* [0x3810] ZH ++ 5clk *) (compile m ? INC (maDIR1 〈x2,x2〉) I) @ -(* [0x3812] (l3) ZL <- A 3clk *) (compile m ? STA (maDIR1 〈x2,x3〉) I) @ -(* [0x3814] goto l1 3clk *) (compile m ? BRA (maIMM1 〈xE,xE〉) I) -(* [0x3816] (l2) si puo' quindi enunciare che - - il caso base X * 0 richiede 12 cicli - - bisogna aggiungere Y * 26 cicli, Y>0 - - bisogna aggiungere ZH * 5 cicli, X * Y > 0xFF *) -). - -(* creazione del processore+caricamento+impostazione registri *) -ndefinition mTest_RS08_mult_status ≝ -λt:memory_impl. -λb1,b2,b3,b4:byte8. - set_z_flag RS08 t (* Z<-true *) - (set_pc_reg RS08 t (* PC<-mTest_RS08_prog *) - (start_of_mcu_version_RS08 - MC9RS08KA2 t - (load_from_source_at t (* carica X,Y,ZH,ZL:mTest_RS08_RAM *) - (load_from_source_at t (zero_memory t) (* carica source in ROM:mTest_RS08_prog *) - mTest_RS08_mult_source mTest_RS08_prog) - [ b1 ; b2 ; b3 ; b4 ] mTest_RS08_RAM) - (build_memory_type_of_mcu_version (FamilyRS08 MC9RS08KA2) t) - (mk_byte8 x0 x0) (mk_byte8 x0 x0) (* non deterministici tutti a 0 *) - false false false false false false (* non deterministici tutti a 0 *) - ) mTest_RS08_prog) - true. - -(* parametrizzazione dell'enunciato del teorema mult *) -(* NB: la memoria e' cambiata e bisogna applicare eq_status *) -ndefinition ok_mTest_RS08_mult_full_aux ≝ -λt:memory_impl.λX,Y:byte8. - eq_anystatus RS08 t - (match execute RS08 t (TickOK ? (mTest_RS08_mult_status t X Y 〈x0,x0〉 〈x0,x0〉)) - (nat12 + (nat26 * (nat_of_b8 Y)) + (nat5 * (nat_of_b8 (w16h (mul_b8 X Y))))) - (* FIXME: alla ALU azzero C perche' la funzione che ne descrive il valore finale e' MOLTO complessa *) - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ set_c_flag RS08 t s false ]) - (set_pc_reg RS08 t (mTest_RS08_mult_status t X 〈x0,x0〉 (w16h (mul_b8 X Y)) (w16l (mul_b8 X Y))) 〈〈x3,x8〉:〈x1,x6〉〉) - (* controllo che coincidano X,Y,ZH,ZL *) - [ 〈〈x0,x0〉:〈x2,x0〉〉 ; 〈〈x0,x0〉:〈x2,x1〉〉 ; 〈〈x0,x0〉:〈x2,x2〉〉 ; 〈〈x0,x0〉:〈x2,x3〉〉 ] = true. - -nlemma ok_mTest_RS08_mult_full : -let X ≝ 〈xF,xF〉 in -let Y ≝ 〈x1,xE〉 in - ∀t:memory_impl. - ok_mTest_RS08_mult_full_aux t X Y. - #t; - nletin X ≝ (〈xF,xF〉); - nletin Y ≝ (〈x1,xE〉); - napply (eq_to_eqanystatus_weak [ 〈〈x0,x0〉:〈x2,x0〉〉 ; 〈〈x0,x0〉:〈x2,x1〉〉 ; 〈〈x0,x0〉:〈x2,x2〉〉 ; 〈〈x0,x0〉:〈x2,x3〉〉 ] RS08 t - (match execute RS08 t (TickOK ? (mTest_RS08_mult_status t X Y 〈x0,x0〉 〈x0,x0〉)) - (nat12 + (nat26 * (nat_of_b8 Y)) + (nat5 * (nat_of_b8 (w16h (mul_b8 X Y))))) - with [ TickERR s _ ⇒ s | TickSUSP s _ ⇒ s | TickOK s ⇒ set_c_flag RS08 t s false ]) - (set_pc_reg RS08 t (mTest_RS08_mult_status t X 〈x0,x0〉 (w16h (mul_b8 X Y)) (w16l (mul_b8 X Y))) 〈〈x3,x8〉:〈x1,x6〉〉)); - nelim t; - nnormalize in ⊢ (? ? ? %); - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests_tools.ma b/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests_tools.ma deleted file mode 100755 index bc225c83a..000000000 --- a/helm/software/matita/contribs/ng_assembly/freescale_tests/micro_tests_tools.ma +++ /dev/null @@ -1,80 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Ultima modifica: 05/08/2009 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". -include "common/list.ma". - -(* ****************************************** *) -(* MICRO TEST DI CORRETTEZZA DELLE ISTRUZIONI *) -(* ****************************************** *) - -(* tabella 0x00 - 0xFF utile da caricare in RAM/ROM *) -ndefinition mTest_bytes : list byte8 ≝ - [ 〈x0,x0〉 ; 〈x0,x1〉 ; 〈x0,x2〉 ; 〈x0,x3〉 ; 〈x0,x4〉 ; 〈x0,x5〉 ; 〈x0,x6〉 ; 〈x0,x7〉 - ; 〈x0,x8〉 ; 〈x0,x9〉 ; 〈x0,xA〉 ; 〈x0,xB〉 ; 〈x0,xC〉 ; 〈x0,xD〉 ; 〈x0,xE〉 ; 〈x0,xF〉 ] -@[ 〈x1,x0〉 ; 〈x1,x1〉 ; 〈x1,x2〉 ; 〈x1,x3〉 ; 〈x1,x4〉 ; 〈x1,x5〉 ; 〈x1,x6〉 ; 〈x1,x7〉 - ; 〈x1,x8〉 ; 〈x1,x9〉 ; 〈x1,xA〉 ; 〈x1,xB〉 ; 〈x1,xC〉 ; 〈x1,xD〉 ; 〈x1,xE〉 ; 〈x1,xF〉 ] -@[ 〈x2,x0〉 ; 〈x2,x1〉 ; 〈x2,x2〉 ; 〈x2,x3〉 ; 〈x2,x4〉 ; 〈x2,x5〉 ; 〈x2,x6〉 ; 〈x2,x7〉 - ; 〈x2,x8〉 ; 〈x2,x9〉 ; 〈x2,xA〉 ; 〈x2,xB〉 ; 〈x2,xC〉 ; 〈x2,xD〉 ; 〈x2,xE〉 ; 〈x2,xF〉 ] -@[ 〈x3,x0〉 ; 〈x3,x1〉 ; 〈x3,x2〉 ; 〈x3,x3〉 ; 〈x3,x4〉 ; 〈x3,x5〉 ; 〈x3,x6〉 ; 〈x3,x7〉 - ; 〈x3,x8〉 ; 〈x3,x9〉 ; 〈x3,xA〉 ; 〈x3,xB〉 ; 〈x3,xC〉 ; 〈x3,xD〉 ; 〈x3,xE〉 ; 〈x3,xF〉 ] -@[ 〈x4,x0〉 ; 〈x4,x1〉 ; 〈x4,x2〉 ; 〈x4,x3〉 ; 〈x4,x4〉 ; 〈x4,x5〉 ; 〈x4,x6〉 ; 〈x4,x7〉 - ; 〈x4,x8〉 ; 〈x4,x9〉 ; 〈x4,xA〉 ; 〈x4,xB〉 ; 〈x4,xC〉 ; 〈x4,xD〉 ; 〈x4,xE〉 ; 〈x4,xF〉 ] -@[ 〈x5,x0〉 ; 〈x5,x1〉 ; 〈x5,x2〉 ; 〈x5,x3〉 ; 〈x5,x4〉 ; 〈x5,x5〉 ; 〈x5,x6〉 ; 〈x5,x7〉 - ; 〈x5,x8〉 ; 〈x5,x9〉 ; 〈x5,xA〉 ; 〈x5,xB〉 ; 〈x5,xC〉 ; 〈x5,xD〉 ; 〈x5,xE〉 ; 〈x5,xF〉 ] -@[ 〈x6,x0〉 ; 〈x6,x1〉 ; 〈x6,x2〉 ; 〈x6,x3〉 ; 〈x6,x4〉 ; 〈x6,x5〉 ; 〈x6,x6〉 ; 〈x6,x7〉 - ; 〈x6,x8〉 ; 〈x6,x9〉 ; 〈x6,xA〉 ; 〈x6,xB〉 ; 〈x6,xC〉 ; 〈x6,xD〉 ; 〈x6,xE〉 ; 〈x6,xF〉 ] -@[ 〈x7,x0〉 ; 〈x7,x1〉 ; 〈x7,x2〉 ; 〈x7,x3〉 ; 〈x7,x4〉 ; 〈x7,x5〉 ; 〈x7,x6〉 ; 〈x7,x7〉 - ; 〈x7,x8〉 ; 〈x7,x9〉 ; 〈x7,xA〉 ; 〈x7,xB〉 ; 〈x7,xC〉 ; 〈x7,xD〉 ; 〈x7,xE〉 ; 〈x7,xF〉 ] -@[ 〈x8,x0〉 ; 〈x8,x1〉 ; 〈x8,x2〉 ; 〈x8,x3〉 ; 〈x8,x4〉 ; 〈x8,x5〉 ; 〈x8,x6〉 ; 〈x8,x7〉 - ; 〈x8,x8〉 ; 〈x8,x9〉 ; 〈x8,xA〉 ; 〈x8,xB〉 ; 〈x8,xC〉 ; 〈x8,xD〉 ; 〈x8,xE〉 ; 〈x8,xF〉 ] -@[ 〈x9,x0〉 ; 〈x9,x1〉 ; 〈x9,x2〉 ; 〈x9,x3〉 ; 〈x9,x4〉 ; 〈x9,x5〉 ; 〈x9,x6〉 ; 〈x9,x7〉 - ; 〈x9,x8〉 ; 〈x9,x9〉 ; 〈x9,xA〉 ; 〈x9,xB〉 ; 〈x9,xC〉 ; 〈x9,xD〉 ; 〈x9,xE〉 ; 〈x9,xF〉 ] -@[ 〈xA,x0〉 ; 〈xA,x1〉 ; 〈xA,x2〉 ; 〈xA,x3〉 ; 〈xA,x4〉 ; 〈xA,x5〉 ; 〈xA,x6〉 ; 〈xA,x7〉 - ; 〈xA,x8〉 ; 〈xA,x9〉 ; 〈xA,xA〉 ; 〈xA,xB〉 ; 〈xA,xC〉 ; 〈xA,xD〉 ; 〈xA,xE〉 ; 〈xA,xF〉 ] -@[ 〈xB,x0〉 ; 〈xB,x1〉 ; 〈xB,x2〉 ; 〈xB,x3〉 ; 〈xB,x4〉 ; 〈xB,x5〉 ; 〈xB,x6〉 ; 〈xB,x7〉 - ; 〈xB,x8〉 ; 〈xB,x9〉 ; 〈xB,xA〉 ; 〈xB,xB〉 ; 〈xB,xC〉 ; 〈xB,xD〉 ; 〈xB,xE〉 ; 〈xB,xF〉 ] -@[ 〈xC,x0〉 ; 〈xC,x1〉 ; 〈xC,x2〉 ; 〈xC,x3〉 ; 〈xC,x4〉 ; 〈xC,x5〉 ; 〈xC,x6〉 ; 〈xC,x7〉 - ; 〈xC,x8〉 ; 〈xC,x9〉 ; 〈xC,xA〉 ; 〈xC,xB〉 ; 〈xC,xC〉 ; 〈xC,xD〉 ; 〈xC,xE〉 ; 〈xC,xF〉 ] -@[ 〈xD,x0〉 ; 〈xD,x1〉 ; 〈xD,x2〉 ; 〈xD,x3〉 ; 〈xD,x4〉 ; 〈xD,x5〉 ; 〈xD,x6〉 ; 〈xD,x7〉 - ; 〈xD,x8〉 ; 〈xD,x9〉 ; 〈xD,xA〉 ; 〈xD,xB〉 ; 〈xD,xC〉 ; 〈xD,xD〉 ; 〈xD,xE〉 ; 〈xD,xF〉 ] -@[ 〈xE,x0〉 ; 〈xE,x1〉 ; 〈xE,x2〉 ; 〈xE,x3〉 ; 〈xE,x4〉 ; 〈xE,x5〉 ; 〈xE,x6〉 ; 〈xE,x7〉 - ; 〈xE,x8〉 ; 〈xE,x9〉 ; 〈xE,xA〉 ; 〈xE,xB〉 ; 〈xE,xC〉 ; 〈xE,xD〉 ; 〈xE,xE〉 ; 〈xE,xF〉 ] -@[ 〈xF,x0〉 ; 〈xF,x1〉 ; 〈xF,x2〉 ; 〈xF,x3〉 ; 〈xF,x4〉 ; 〈xF,x5〉 ; 〈xF,x6〉 ; 〈xF,x7〉 - ; 〈xF,x8〉 ; 〈xF,x9〉 ; 〈xF,xA〉 ; 〈xF,xB〉 ; 〈xF,xC〉 ; 〈xF,xD〉 ; 〈xF,xE〉 ; 〈xF,xF〉 - ]. - -(* - 1) mTest_x_RAM : inizio della RAM - (start point per caricamento mTest_bytes in RAM) - 2) mTest_x_prog: inizio della ROM - (start point per caricamento programma in ROM) - 3) mTest_x_data: ultimi 256b della ROM - (start point per caricamento mTest_bytes in ROM) -*) -ndefinition mTest_HCS08_RAM ≝ 〈〈x0,x0〉:〈x7,x0〉〉. -ndefinition mTest_HCS08_prog ≝ 〈〈x1,x8〉:〈x6,x0〉〉. -ndefinition mTest_HCS08_data ≝ 〈〈xF,xF〉:〈x0,x0〉〉. - -ndefinition mTest_RS08_RAM ≝ 〈〈x0,x0〉:〈x2,x0〉〉. -ndefinition mTest_RS08_prog ≝ 〈〈x3,x8〉:〈x0,x0〉〉. -ndefinition mTest_RS08_data ≝ 〈〈x3,xF〉:〈x0,x0〉〉. diff --git a/helm/software/matita/contribs/ng_assembly/memory/memory_abs.ma b/helm/software/matita/contribs/ng_assembly/memory/memory_abs.ma deleted file mode 100755 index a9988c492..000000000 --- a/helm/software/matita/contribs/ng_assembly/memory/memory_abs.ma +++ /dev/null @@ -1,243 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "memory/memory_func.ma". -include "memory/memory_trees.ma". -include "memory/memory_bits.ma". - -(* ********************************************* *) -(* ASTRAZIONE DALL'IMPLEMENTAZIONE DELLA MEMORIA *) -(* ********************************************* *) - -(* tipi di implementazione della memoria *) -ninductive memory_impl : Type ≝ - MEM_FUNC: memory_impl -| MEM_TREE: memory_impl -| MEM_BITS: memory_impl. - -(* ausiliario per il tipo della memoria *) -ndefinition aux_mem_type ≝ -λt:memory_impl.match t with - [ MEM_FUNC ⇒ word32 → byte8 - | MEM_TREE ⇒ aux_32B_type byte8 - | MEM_BITS ⇒ aux_32B_type (Array8T bool) - ]. - -(* ausiliario per il tipo del checker *) -ndefinition aux_chk_type ≝ -λt:memory_impl.match t with - [ MEM_FUNC ⇒ word32 → memory_type - | MEM_TREE ⇒ aux_32B_type memory_type - | MEM_BITS ⇒ aux_32B_type (Array8T memory_type) - ]. - -(* unificazione di out_of_bound_memory *) -ndefinition out_of_bound_memory ≝ -λt:memory_impl. - match t - return λt.aux_chk_type t - with - [ MEM_FUNC ⇒ mf_out_of_bound_memory - | MEM_TREE ⇒ mt_out_of_bound_memory - | MEM_BITS ⇒ mb_out_of_bound_memory - ]. - -(* unificazione di zero_memory *) -ndefinition zero_memory ≝ -λt:memory_impl. - match t - return λt.aux_mem_type t - with - [ MEM_FUNC ⇒ mf_zero_memory - | MEM_TREE ⇒ mt_zero_memory - | MEM_BITS ⇒ mb_zero_memory - ]. - -(* unificazione della lettura senza chk: mem_read_abs mem addr *) -ndefinition mem_read_abs ≝ -λt:memory_impl. - match t - return λt.aux_mem_type t → word32 → byte8 - with - [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. - λaddr:word32. - m addr - | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. - λaddr:word32. - mt_visit ? m addr - | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. - λaddr:word32. - byte8_of_bits (mt_visit ? m addr) - ]. - -(* unificazione del chk *) -ndefinition chk_get ≝ -λt:memory_impl. - match t - return λt.aux_chk_type t → word32 → Array8T memory_type - with - [ MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC.λaddr:word32. - match c addr with - [ MEM_READ_ONLY ⇒ mk_Array8T ? MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY - | MEM_READ_WRITE ⇒ mk_Array8T ? MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE - | MEM_OUT_OF_BOUND ⇒ mk_Array8T ? MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND - ] - | MEM_TREE ⇒ λc:aux_chk_type MEM_TREE.λaddr:word32. - match mt_visit ? c addr with - [ MEM_READ_ONLY ⇒ mk_Array8T ? MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY MEM_READ_ONLY - | MEM_READ_WRITE ⇒ mk_Array8T ? MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE MEM_READ_WRITE - | MEM_OUT_OF_BOUND ⇒ mk_Array8T ? MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND - ] - | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS.λaddr:word32. - mt_visit ? c addr - ]. - -(* unificazione della lettura con chk: mem_read mem chk addr *) -ndefinition mem_read ≝ -λt:memory_impl.λm:aux_mem_type t.λc:aux_chk_type t.λaddr:word32. - match t - return λt.aux_mem_type t → aux_chk_type t → word32 → option byte8 - with - [ MEM_FUNC ⇒ mf_mem_read - | MEM_TREE ⇒ mt_mem_read - | MEM_BITS ⇒ mb_mem_read - ] m c addr. - -(* unificazione della lettura di bit con chk: mem_read mem chk addr sub *) -ndefinition mem_read_bit ≝ -λt:memory_impl. - match t - return λt.aux_mem_type t → aux_chk_type t → word32 → oct → option bool - with - [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. - λc:aux_chk_type MEM_FUNC. - λaddr:word32. - λo:oct. - opt_map … (mf_mem_read m c addr) - (λb.Some ? (getn_array8T o bool (bits_of_byte8 b))) - | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. - λc:aux_chk_type MEM_TREE. - λaddr:word32. - λo:oct. - opt_map … (mt_mem_read m c addr) - (λb.Some ? (getn_array8T o bool (bits_of_byte8 b))) - | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. - λc:aux_chk_type MEM_BITS. - λaddr:word32. - λo:oct. - mb_mem_read_bit m c addr o - ]. - -(* unificazione della scrittura con chk: mem_update mem chk addr val *) -ndefinition mem_update ≝ -λt:memory_impl.λm:aux_mem_type t.λc:aux_chk_type t.λaddr:word32.λv:byte8. - match t - return λt.aux_mem_type t → aux_chk_type t → word32 → byte8 → option (aux_mem_type t) - with - [ MEM_FUNC ⇒ mf_mem_update - | MEM_TREE ⇒ mt_mem_update - | MEM_BITS ⇒ mb_mem_update - ] m c addr v. - -(* unificazione della scrittura di bit con chk: mem_update mem chk addr sub val *) -ndefinition mem_update_bit ≝ -λt:memory_impl. - match t - return λt.aux_mem_type t → aux_chk_type t → word32 → oct → bool → option (aux_mem_type t) - with - [ MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. - λc:aux_chk_type MEM_FUNC. - λaddr:word32. - λo:oct. - λv:bool. - mf_mem_update m c addr (byte8_of_bits (setn_array8T o bool (bits_of_byte8 (m addr)) v)) - | MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. - λc:aux_chk_type MEM_TREE. - λaddr:word32. - λo:oct. - λv:bool. - mt_mem_update m c addr (byte8_of_bits (setn_array8T o bool (bits_of_byte8 (mt_visit ? m addr)) v)) - | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. - λc:aux_chk_type MEM_BITS. - λaddr:word32. - λo:oct. - λv:bool. - mb_mem_update_bit m c addr o v - ]. - -(* unificazione del caricamento: load_from_source_at old_mem source addr *) -ndefinition load_from_source_at ≝ -λt:memory_impl.λm:aux_mem_type t.λl:list byte8.λaddr:word32. - match t - return λt.aux_mem_type t → list byte8 → word32 → aux_mem_type t - with - [ MEM_FUNC ⇒ mf_load_from_source_at - | MEM_TREE ⇒ mt_load_from_source_at - | MEM_BITS ⇒ mb_load_from_source_at - ] m l addr. - -(* unificazione dell'impostazione della memoria: chk_update_ranged chk inf sup v *) -ndefinition check_update_ranged ≝ -λt:memory_impl. - match t - return λt.aux_chk_type t → word32 → word16 → memory_type → aux_chk_type t - with - [ MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC. - λaddr:word32. - λrange:word16. - λv:memory_type. - mf_check_update_ranged c addr range v - | MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. - λaddr:word32. - λrange:word16. - λv:memory_type. - mt_update_ranged ? c addr ? (w16_to_recw16 range) v - | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS. - λaddr:word32. - λrange:word16. - λv:memory_type. - mt_update_ranged ? c addr ? (w16_to_recw16 range) (mk_Array8T ? v v v v v v v v) - ]. - -(* unificazione dell'impostazione dei bit: chk_update_bit chk addr sub v *) -(* NB: dove non esiste la granularita' del bit, lascio inalterato *) -ndefinition check_update_bit ≝ -λt:memory_impl. - match t - return λt.aux_chk_type t → word32 → oct → memory_type → aux_chk_type t - with - [ MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC. - λaddr:word32. - λo:oct. - λv:memory_type. - c - | MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. - λaddr:word32. - λo:oct. - λv:memory_type. - c - | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS. - λaddr:word32. - λo:oct. - λv:memory_type. - mb_chk_update_bit c addr o v - ]. diff --git a/helm/software/matita/contribs/ng_assembly/memory/memory_bits.ma b/helm/software/matita/contribs/ng_assembly/memory/memory_bits.ma deleted file mode 100755 index 396ad9a07..000000000 --- a/helm/software/matita/contribs/ng_assembly/memory/memory_bits.ma +++ /dev/null @@ -1,181 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "memory/memory_trees.ma". - -(* ********************* *) -(* MEMORIA E DESCRITTORE *) -(* ********************* *) - -(* tutta la memoria non installata *) -ndefinition mb_out_of_bound_memory ≝ - aux_32B_filler ? - (mk_Array8T ? MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND - MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND MEM_OUT_OF_BOUND). - -(* tutta la memoria a 0 *) -ndefinition mb_zero_memory ≝ - aux_32B_filler ? (mk_Array8T ? false false false false false false false false). - -(* scrivi bit controllando il tipo di memoria *) -ndefinition mb_mem_update_bit ≝ -λmem:aux_32B_type (Array8T bool). -λchk:aux_32B_type (Array8T memory_type). -λaddr:word32.λsub:oct.λv:bool. - match getn_array8T sub ? (mt_visit ? chk addr) with - (* ROM? ok, ma il valore viene perso *) - [ MEM_READ_ONLY ⇒ Some ? mem - (* RAM? ok *) - | MEM_READ_WRITE ⇒ Some ? (mt_update ? mem addr (setn_array8T sub ? (mt_visit ? mem addr) v)) - (* NON INSTALLATA? no *) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -ndefinition mb_mem_update ≝ -λmem:aux_32B_type (Array8T bool). -λchk:aux_32B_type (Array8T memory_type). -λaddr:word32.λv:byte8. -let old_value ≝ mt_visit (Array8T bool) mem addr in -let new_value ≝ bits_of_byte8 v in -let memtypes ≝ mt_visit (Array8T memory_type) chk addr in -let newbit0 ≝ match getn_array8T o0 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o0 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o0 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit1 ≝ match getn_array8T o1 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o1 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o1 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit2 ≝ match getn_array8T o2 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o2 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o2 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit3 ≝ match getn_array8T o3 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o3 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o3 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit4 ≝ match getn_array8T o4 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o4 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o4 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit5 ≝ match getn_array8T o5 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o5 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o5 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit6 ≝ match getn_array8T o6 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o6 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o6 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit7 ≝ match getn_array8T o7 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o7 bool old_value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o7 bool new_value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in - opt_map … newbit0 - (λnb0.opt_map … newbit1 - (λnb1.opt_map … newbit2 - (λnb2.opt_map … newbit3 - (λnb3.opt_map … newbit4 - (λnb4.opt_map … newbit5 - (λnb5.opt_map … newbit6 - (λnb6.opt_map … newbit7 - (λnb7.Some ? (mt_update ? mem addr (mk_Array8T bool nb7 nb6 nb5 nb4 nb3 nb2 nb1 nb0)))))))))). - -(* scrivi tipo di bit *) -ndefinition mb_chk_update_bit ≝ -λchk:aux_32B_type (Array8T memory_type). -λaddr:word32.λsub:oct.λv:memory_type. - mt_update ? chk addr (setn_array8T sub ? (mt_visit ? chk addr) v). - -(* leggi bit controllando il tipo di memoria *) -ndefinition mb_mem_read_bit ≝ -λmem:aux_32B_type (Array8T bool). -λchk:aux_32B_type (Array8T memory_type). -λaddr:word32.λsub:oct. - match getn_array8T sub ? (mt_visit ? chk addr) with - (* ROM? ok, ma il valore viene perso *) - [ MEM_READ_ONLY ⇒ Some ? (getn_array8T sub ? (mt_visit ? mem addr)) - (* RAM? ok *) - | MEM_READ_WRITE ⇒ Some ? (getn_array8T sub ? (mt_visit ? mem addr)) - (* NON INSTALLATA? no *) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -(* leggi controllando il tipo di memoria *) -(* NB: devono esistere tutti i bit *) -ndefinition mb_mem_read ≝ -λmem:aux_32B_type (Array8T bool). -λchk:aux_32B_type (Array8T memory_type). -λaddr:word32. -let value ≝ mt_visit (Array8T bool) mem addr in -let memtypes ≝ mt_visit (Array8T memory_type) chk addr in -let newbit0 ≝ match getn_array8T o0 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o0 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o0 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit1 ≝ match getn_array8T o1 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o1 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o1 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit2 ≝ match getn_array8T o2 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o2 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o2 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit3 ≝ match getn_array8T o3 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o3 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o3 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit4 ≝ match getn_array8T o4 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o4 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o4 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit5 ≝ match getn_array8T o5 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o5 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o5 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit6 ≝ match getn_array8T o6 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o6 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o6 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in -let newbit7 ≝ match getn_array8T o7 memory_type memtypes with - [ MEM_READ_ONLY ⇒ Some bool (getn_array8T o7 bool value) - | MEM_READ_WRITE ⇒ Some bool (getn_array8T o7 bool value) - | MEM_OUT_OF_BOUND ⇒ None bool ] in - opt_map … newbit0 - (λnb0.opt_map … newbit1 - (λnb1.opt_map … newbit2 - (λnb2.opt_map … newbit3 - (λnb3.opt_map … newbit4 - (λnb4.opt_map … newbit5 - (λnb5.opt_map … newbit6 - (λnb6.opt_map … newbit7 - (λnb7.Some ? (byte8_of_bits (mk_Array8T bool nb7 nb6 nb5 nb4 nb3 nb2 nb1 nb0)))))))))). - -(* ************************** *) -(* CARICAMENTO PROGRAMMA/DATI *) -(* ************************** *) - -(* carica a paratire da addr, scartando source (pescando da old_mem) se si supera 0xFFFF... *) -nlet rec mb_load_from_source_at (old_mem:aux_32B_type (Array8T bool)) - (src:list byte8) (addr:word32) on src ≝ - match src with - (* fine di source: carica da old_mem *) - [ nil ⇒ old_mem - | cons hd tl ⇒ mb_load_from_source_at (mt_update ? old_mem addr (bits_of_byte8 hd)) tl (succ_w32 addr) - ]. diff --git a/helm/software/matita/contribs/ng_assembly/memory/memory_func.ma b/helm/software/matita/contribs/ng_assembly/memory/memory_func.ma deleted file mode 100755 index 96c2ee742..000000000 --- a/helm/software/matita/contribs/ng_assembly/memory/memory_func.ma +++ /dev/null @@ -1,79 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "memory/memory_struct.ma". -include "num/word32.ma". -include "common/option.ma". -include "common/list.ma". - -(* ********************* *) -(* MEMORIA E DESCRITTORE *) -(* ********************* *) - -(* (mf_check_update_ranged chk inf sup mode) = setta tipo memoria *) -ndefinition mf_check_update_ranged ≝ -λf:word32 → memory_type.λaddr:word32.λrange:word16.λv. - λx.match inrange_w32 x addr (plus_w32_d_d addr 〈〈〈x0,x0〉:〈x0,x0〉〉.range〉) with - [ true ⇒ v - | false ⇒ f x ]. - -(* tutta la memoria non installata *) -ndefinition mf_out_of_bound_memory ≝ λ_:word32.MEM_OUT_OF_BOUND. - -(* (mf_mem_update mem checked addr val) = scrivi controllando il tipo di memoria *) -ndefinition mf_mem_update ≝ -λf:word32 → byte8.λc:word32 → memory_type.λa:word32.λv:byte8. - match c a with - (* ROM? ok, ma il valore viene perso *) - [ MEM_READ_ONLY ⇒ Some ? f - (* RAM? ok *) - | MEM_READ_WRITE ⇒ Some ? (λx.match eq_w32 x a with [ true ⇒ v | false ⇒ f x ]) - (* NON INSTALLATA? no *) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -(* tutta la memoria a 0 *) -ndefinition mf_zero_memory ≝ λ_:word32.〈x0,x0〉. - -(* (mf_mem_read mem check addr) = leggi controllando il tipo di memoria *) -ndefinition mf_mem_read ≝ -λf:word32 → byte8.λc:word32 → memory_type.λa. - match c a with - [ MEM_READ_ONLY ⇒ Some ? (f a) - | MEM_READ_WRITE ⇒ Some ? (f a) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -(* ************************** *) -(* CARICAMENTO PROGRAMMA/DATI *) -(* ************************** *) - -(* carica a paratire da addr, overflow se si supera 0xFFFF... *) -nlet rec mf_load_from_source_at (old_mem:word32 → byte8) (src:list byte8) (addr:word32) on src ≝ - match src with - (* fine di source: carica da old_mem *) - [ nil ⇒ old_mem - | cons hd tl ⇒ λx:word32.match eq_w32 addr x with - (* la locazione corrisponde al punto corrente di source *) - [ true ⇒ hd - (* la locazione e' piu' avanti? ricorsione *) - | false ⇒ (mf_load_from_source_at old_mem tl (plus_w32_d_d addr 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x1〉〉〉)) x - ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/memory/memory_struct.ma b/helm/software/matita/contribs/ng_assembly/memory/memory_struct.ma deleted file mode 100755 index 0e023b5a1..000000000 --- a/helm/software/matita/contribs/ng_assembly/memory/memory_struct.ma +++ /dev/null @@ -1,659 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/oct.ma". -include "num/byte8.ma". - -(* **************************** *) -(* TIPI PER I MODULI DI MEMORIA *) -(* **************************** *) - -(* tipi di memoria:RAM/ROM/non installata *) -ninductive memory_type : Type ≝ - MEM_READ_ONLY: memory_type -| MEM_READ_WRITE: memory_type -| MEM_OUT_OF_BOUND: memory_type. - -(* **************** *) -(* TIPO ARRAY DA 16 *) -(* **************** *) - -(* definizione di un array omogeneo di dimensione 16 *) -nrecord Array16T (T:Type) : Type ≝ -{ a16_1 : T ; a16_2 : T ; a16_3 : T ; a16_4 : T -; a16_5 : T ; a16_6 : T ; a16_7 : T ; a16_8 : T -; a16_9 : T ; a16_10 : T ; a16_11 : T ; a16_12 : T -; a16_13 : T ; a16_14 : T ; a16_15 : T ; a16_16 : T }. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un getter a matrice sull'array *) - -ndefinition getn_array16T ≝ -λn:exadecim.λT:Type.λp:Array16T T. - match n return λn.(Array16T T) → T with - [ x0 ⇒ a16_1 T | x1 ⇒ a16_2 T | x2 ⇒ a16_3 T | x3 ⇒ a16_4 T - | x4 ⇒ a16_5 T | x5 ⇒ a16_6 T | x6 ⇒ a16_7 T | x7 ⇒ a16_8 T - | x8 ⇒ a16_9 T | x9 ⇒ a16_10 T | xA ⇒ a16_11 T | xB ⇒ a16_12 T - | xC ⇒ a16_13 T | xD ⇒ a16_14 T | xE ⇒ a16_15 T | xF ⇒ a16_16 T - ] p. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un setter a matrice sull'array *) -ndefinition setn_array16T ≝ -λn:exadecim.λT:Type.λp:Array16T T.λv:T. -let e00 ≝ (a16_1 T p) in -let e01 ≝ (a16_2 T p) in -let e02 ≝ (a16_3 T p) in -let e03 ≝ (a16_4 T p) in -let e04 ≝ (a16_5 T p) in -let e05 ≝ (a16_6 T p) in -let e06 ≝ (a16_7 T p) in -let e07 ≝ (a16_8 T p) in -let e08 ≝ (a16_9 T p) in -let e09 ≝ (a16_10 T p) in -let e10 ≝ (a16_11 T p) in -let e11 ≝ (a16_12 T p) in -let e12 ≝ (a16_13 T p) in -let e13 ≝ (a16_14 T p) in -let e14 ≝ (a16_15 T p) in -let e15 ≝ (a16_16 T p) in - match n with - [ x0 ⇒ mk_Array16T T v e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x1 ⇒ mk_Array16T T e00 v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x2 ⇒ mk_Array16T T e00 e01 v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x3 ⇒ mk_Array16T T e00 e01 e02 v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x4 ⇒ mk_Array16T T e00 e01 e02 e03 v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 v - ]. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un setter multiplo [m,n] a matrice sull'array *) -(* m ≤ n *) -ndefinition setmn_array16T ≝ -λm,n:exadecim.λT:Type.λp:Array16T T.λv:T. -let e00 ≝ (a16_1 T p) in -let e01 ≝ (a16_2 T p) in -let e02 ≝ (a16_3 T p) in -let e03 ≝ (a16_4 T p) in -let e04 ≝ (a16_5 T p) in -let e05 ≝ (a16_6 T p) in -let e06 ≝ (a16_7 T p) in -let e07 ≝ (a16_8 T p) in -let e08 ≝ (a16_9 T p) in -let e09 ≝ (a16_10 T p) in -let e10 ≝ (a16_11 T p) in -let e11 ≝ (a16_12 T p) in -let e12 ≝ (a16_13 T p) in -let e13 ≝ (a16_14 T p) in -let e14 ≝ (a16_15 T p) in -let e15 ≝ (a16_16 T p) in - match m with - [ x0 ⇒ match n with - [ x0 ⇒ mk_Array16T T v e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x1 ⇒ mk_Array16T T v v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x2 ⇒ mk_Array16T T v v v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x3 ⇒ mk_Array16T T v v v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x4 ⇒ mk_Array16T T v v v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T v v v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T v v v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T v v v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T v v v v v v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T v v v v v v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T v v v v v v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T v v v v v v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T v v v v v v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T v v v v v v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T v v v v v v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T v v v v v v v v v v v v v v v v ] - | x1 ⇒ match n with - [ x0 ⇒ p - | x1 ⇒ mk_Array16T T e00 v e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x2 ⇒ mk_Array16T T e00 v v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x3 ⇒ mk_Array16T T e00 v v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x4 ⇒ mk_Array16T T e00 v v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T e00 v v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 v v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 v v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 v v v v v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 v v v v v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 v v v v v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 v v v v v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 v v v v v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 v v v v v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 v v v v v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 v v v v v v v v v v v v v v v ] - | x2 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p - | x2 ⇒ mk_Array16T T e00 e01 v e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x3 ⇒ mk_Array16T T e00 e01 v v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x4 ⇒ mk_Array16T T e00 e01 v v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T e00 e01 v v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 e01 v v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 v v v v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 v v v v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 v v v v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 v v v v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 v v v v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 v v v v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 v v v v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 v v v v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 v v v v v v v v v v v v v v ] - | x3 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p - | x3 ⇒ mk_Array16T T e00 e01 e02 v e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x4 ⇒ mk_Array16T T e00 e01 e02 v v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T e00 e01 e02 v v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 e01 e02 v v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 e02 v v v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 v v v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 v v v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 v v v v v v v v v v v v v ] - | x4 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p - | x4 ⇒ mk_Array16T T e00 e01 e02 e03 v e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x5 ⇒ mk_Array16T T e00 e01 e02 e03 v v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 e01 e02 e03 v v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 e02 e03 v v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 v v v v v v v v v v v v ] - | x5 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p - | x5 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v e06 e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x6 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 v v v v v v v v v v v ] - | x6 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p - | x6 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v e07 e08 e09 e10 e11 e12 e13 e14 e15 - | x7 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 v v v v v v v v v v ] - | x7 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p - | x7 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v e08 e09 e10 e11 e12 e13 e14 e15 - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 v v v v v v v v v ] - | x8 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v e09 e10 e11 e12 e13 e14 e15 - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 v v v v v v v v ] - | x9 ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p - | x9 ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v e10 e11 e12 e13 e14 e15 - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 v v v v v v v ] - | xA ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p - | xA ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v e11 e12 e13 e14 e15 - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 v v v v v v ] - | xB ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p | xA ⇒ p - | xB ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v e12 e13 e14 e15 - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 v v v v v ] - | xC ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p - | xC ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v e13 e14 e15 - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 v v v v ] - | xD ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p - | xD ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v e14 e15 - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 v v v ] - | xE ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p | xD ⇒ p - | xE ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v e15 - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 v v ] - | xF ⇒ match n with - [ x0 ⇒ p | x1 ⇒ p | x2 ⇒ p | x3 ⇒ p | x4 ⇒ p | x5 ⇒ p | x6 ⇒ p | x7 ⇒ p - | x8 ⇒ p | x9 ⇒ p | xA ⇒ p | xB ⇒ p | xC ⇒ p | xD ⇒ p | xE ⇒ p - | xF ⇒ mk_Array16T T e00 e01 e02 e03 e04 e05 e06 e07 e08 e09 e10 e11 e12 e13 e14 v ] - ]. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un setter composto [m+1,n-1] a matrice sull'array *) -(* NB: obbiettivo evitare l'overflow *) -ndefinition setmn_array16T_succ_pred ≝ -λm,n:exadecim.λT:Type.λp:Array16T T.λv:T. - match lt_ex m xF with - [ true ⇒ match gt_ex n x0 with - [ true ⇒ setmn_array16T (succ_ex m) (pred_ex n) T p v - | false ⇒ p - ] - | false ⇒ p - ]. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un setter composto [m+1,F] a matrice sull'array *) -(* NB: obbiettivo evitare l'overflow *) -ndefinition setmn_array16T_succ ≝ -λm:exadecim.λT:Type.λp:Array16T T.λv:T. - match lt_ex m xF with - [ true ⇒ setmn_array16T (succ_ex m) xF T p v - | false ⇒ p - ]. - -(* abbiamo gia' gli esadecimali come tipo induttivo quindi: *) -(* posso definire un setter composto [0,n-1] a matrice sull'array *) -(* NB: obbiettivo evitare l'overflow *) -ndefinition setmn_array16T_pred ≝ -λn:exadecim.λT:Type.λp:Array16T T.λv:T. - match gt_ex n x0 with - [ true ⇒ setmn_array16T x0 (pred_ex n) T p v - | false ⇒ p - ]. - -(* ************************** *) -(* TIPO BYTE COME INSIEME BIT *) -(* ************************** *) - -(* definizione di un byte come 8 bit *) -nrecord Array8T (T:Type) : Type ≝ -{ a8_1 : T ; a8_2 : T ; a8_3 : T ; a8_4 : T -; a8_5 : T ; a8_6 : T ; a8_7 : T ; a8_8 : T }. - -(* abbiamo gia' gli ottali come tipo induttivo quindi: *) -(* posso definire un getter a matrice sull'array *) -ndefinition getn_array8T ≝ -λn:oct.λT:Type.λp:Array8T T. - match n return λn.(Array8T T) → T with - [ o0 ⇒ a8_1 T | o1 ⇒ a8_2 T | o2 ⇒ a8_3 T | o3 ⇒ a8_4 T - | o4 ⇒ a8_5 T | o5 ⇒ a8_6 T | o6 ⇒ a8_7 T | o7 ⇒ a8_8 T - ] p. - -(* abbiamo gia' gli ottali come tipo induttivo quindi: *) -(* posso definire un setter a matrice sull'array *) -ndefinition setn_array8T ≝ -λn:oct.λT:Type.λp:Array8T T.λv:T. -let e00 ≝ (a8_1 T p) in -let e01 ≝ (a8_2 T p) in -let e02 ≝ (a8_3 T p) in -let e03 ≝ (a8_4 T p) in -let e04 ≝ (a8_5 T p) in -let e05 ≝ (a8_6 T p) in -let e06 ≝ (a8_7 T p) in -let e07 ≝ (a8_8 T p) in - match n with - [ o0 ⇒ mk_Array8T T e07 e06 e05 e04 e03 e02 e01 v - | o1 ⇒ mk_Array8T T e07 e06 e05 e04 e03 e02 v e00 - | o2 ⇒ mk_Array8T T e07 e06 e05 e04 e03 v e01 e00 - | o3 ⇒ mk_Array8T T e07 e06 e05 e04 v e02 e01 e00 - | o4 ⇒ mk_Array8T T e07 e06 e05 v e03 e02 e01 e00 - | o5 ⇒ mk_Array8T T e07 e06 v e04 e03 e02 e01 e00 - | o6 ⇒ mk_Array8T T e07 v e05 e04 e03 e02 e01 e00 - | o7 ⇒ mk_Array8T T v e06 e05 e04 e03 e02 e01 e00 - ]. - -(* lettura byte *) -ndefinition byte8_of_bits ≝ -λp:Array8T bool. - mk_byte8 - (or_ex (match a8_8 ? p with [ true ⇒ x8 | false ⇒ x0 ]) - (or_ex (match a8_7 ? p with [ true ⇒ x4 | false ⇒ x0 ]) - (or_ex (match a8_6 ? p with [ true ⇒ x2 | false ⇒ x0 ]) - (match a8_5 ? p with [ true ⇒ x1 | false ⇒ x0 ])))) - (or_ex (match a8_4 ? p with [ true ⇒ x8 | false ⇒ x0 ]) - (or_ex (match a8_3 ? p with [ true ⇒ x4 | false ⇒ x0 ]) - (or_ex (match a8_2 ? p with [ true ⇒ x2 | false ⇒ x0 ]) - (match a8_1 ? p with [ true ⇒ x1 | false ⇒ x0 ])))). - -(* scrittura byte *) -ndefinition bits_of_byte8 ≝ -λp:byte8. - match b8h p with - [ x0 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false false false false false false false false - | x1 ⇒ mk_Array8T bool false false false false false false false true - | x2 ⇒ mk_Array8T bool false false false false false false true false - | x3 ⇒ mk_Array8T bool false false false false false false true true - | x4 ⇒ mk_Array8T bool false false false false false true false false - | x5 ⇒ mk_Array8T bool false false false false false true false true - | x6 ⇒ mk_Array8T bool false false false false false true true false - | x7 ⇒ mk_Array8T bool false false false false false true true true - | x8 ⇒ mk_Array8T bool false false false false true false false false - | x9 ⇒ mk_Array8T bool false false false false true false false true - | xA ⇒ mk_Array8T bool false false false false true false true false - | xB ⇒ mk_Array8T bool false false false false true false true true - | xC ⇒ mk_Array8T bool false false false false true true false false - | xD ⇒ mk_Array8T bool false false false false true true false true - | xE ⇒ mk_Array8T bool false false false false true true true false - | xF ⇒ mk_Array8T bool false false false false true true true true ] - | x1 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false false false true false false false false - | x1 ⇒ mk_Array8T bool false false false true false false false true - | x2 ⇒ mk_Array8T bool false false false true false false true false - | x3 ⇒ mk_Array8T bool false false false true false false true true - | x4 ⇒ mk_Array8T bool false false false true false true false false - | x5 ⇒ mk_Array8T bool false false false true false true false true - | x6 ⇒ mk_Array8T bool false false false true false true true false - | x7 ⇒ mk_Array8T bool false false false true false true true true - | x8 ⇒ mk_Array8T bool false false false true true false false false - | x9 ⇒ mk_Array8T bool false false false true true false false true - | xA ⇒ mk_Array8T bool false false false true true false true false - | xB ⇒ mk_Array8T bool false false false true true false true true - | xC ⇒ mk_Array8T bool false false false true true true false false - | xD ⇒ mk_Array8T bool false false false true true true false true - | xE ⇒ mk_Array8T bool false false false true true true true false - | xF ⇒ mk_Array8T bool false false false true true true true true ] - | x2 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false false true false false false false false - | x1 ⇒ mk_Array8T bool false false true false false false false true - | x2 ⇒ mk_Array8T bool false false true false false false true false - | x3 ⇒ mk_Array8T bool false false true false false false true true - | x4 ⇒ mk_Array8T bool false false true false false true false false - | x5 ⇒ mk_Array8T bool false false true false false true false true - | x6 ⇒ mk_Array8T bool false false true false false true true false - | x7 ⇒ mk_Array8T bool false false true false false true true true - | x8 ⇒ mk_Array8T bool false false true false true false false false - | x9 ⇒ mk_Array8T bool false false true false true false false true - | xA ⇒ mk_Array8T bool false false true false true false true false - | xB ⇒ mk_Array8T bool false false true false true false true true - | xC ⇒ mk_Array8T bool false false true false true true false false - | xD ⇒ mk_Array8T bool false false true false true true false true - | xE ⇒ mk_Array8T bool false false true false true true true false - | xF ⇒ mk_Array8T bool false false true false true true true true ] - | x3 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false false true true false false false false - | x1 ⇒ mk_Array8T bool false false true true false false false true - | x2 ⇒ mk_Array8T bool false false true true false false true false - | x3 ⇒ mk_Array8T bool false false true true false false true true - | x4 ⇒ mk_Array8T bool false false true true false true false false - | x5 ⇒ mk_Array8T bool false false true true false true false true - | x6 ⇒ mk_Array8T bool false false true true false true true false - | x7 ⇒ mk_Array8T bool false false true true false true true true - | x8 ⇒ mk_Array8T bool false false true true true false false false - | x9 ⇒ mk_Array8T bool false false true true true false false true - | xA ⇒ mk_Array8T bool false false true true true false true false - | xB ⇒ mk_Array8T bool false false true true true false true true - | xC ⇒ mk_Array8T bool false false true true true true false false - | xD ⇒ mk_Array8T bool false false true true true true false true - | xE ⇒ mk_Array8T bool false false true true true true true false - | xF ⇒ mk_Array8T bool false false true true true true true true ] - | x4 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false true false false false false false false - | x1 ⇒ mk_Array8T bool false true false false false false false true - | x2 ⇒ mk_Array8T bool false true false false false false true false - | x3 ⇒ mk_Array8T bool false true false false false false true true - | x4 ⇒ mk_Array8T bool false true false false false true false false - | x5 ⇒ mk_Array8T bool false true false false false true false true - | x6 ⇒ mk_Array8T bool false true false false false true true false - | x7 ⇒ mk_Array8T bool false true false false false true true true - | x8 ⇒ mk_Array8T bool false true false false true false false false - | x9 ⇒ mk_Array8T bool false true false false true false false true - | xA ⇒ mk_Array8T bool false true false false true false true false - | xB ⇒ mk_Array8T bool false true false false true false true true - | xC ⇒ mk_Array8T bool false true false false true true false false - | xD ⇒ mk_Array8T bool false true false false true true false true - | xE ⇒ mk_Array8T bool false true false false true true true false - | xF ⇒ mk_Array8T bool false true false false true true true true ] - | x5 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false true false true false false false false - | x1 ⇒ mk_Array8T bool false true false true false false false true - | x2 ⇒ mk_Array8T bool false true false true false false true false - | x3 ⇒ mk_Array8T bool false true false true false false true true - | x4 ⇒ mk_Array8T bool false true false true false true false false - | x5 ⇒ mk_Array8T bool false true false true false true false true - | x6 ⇒ mk_Array8T bool false true false true false true true false - | x7 ⇒ mk_Array8T bool false true false true false true true true - | x8 ⇒ mk_Array8T bool false true false true true false false false - | x9 ⇒ mk_Array8T bool false true false true true false false true - | xA ⇒ mk_Array8T bool false true false true true false true false - | xB ⇒ mk_Array8T bool false true false true true false true true - | xC ⇒ mk_Array8T bool false true false true true true false false - | xD ⇒ mk_Array8T bool false true false true true true false true - | xE ⇒ mk_Array8T bool false true false true true true true false - | xF ⇒ mk_Array8T bool false true false true true true true true ] - | x6 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false true true false false false false false - | x1 ⇒ mk_Array8T bool false true true false false false false true - | x2 ⇒ mk_Array8T bool false true true false false false true false - | x3 ⇒ mk_Array8T bool false true true false false false true true - | x4 ⇒ mk_Array8T bool false true true false false true false false - | x5 ⇒ mk_Array8T bool false true true false false true false true - | x6 ⇒ mk_Array8T bool false true true false false true true false - | x7 ⇒ mk_Array8T bool false true true false false true true true - | x8 ⇒ mk_Array8T bool false true true false true false false false - | x9 ⇒ mk_Array8T bool false true true false true false false true - | xA ⇒ mk_Array8T bool false true true false true false true false - | xB ⇒ mk_Array8T bool false true true false true false true true - | xC ⇒ mk_Array8T bool false true true false true true false false - | xD ⇒ mk_Array8T bool false true true false true true false true - | xE ⇒ mk_Array8T bool false true true false true true true false - | xF ⇒ mk_Array8T bool false true true false true true true true ] - | x7 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool false true true true false false false false - | x1 ⇒ mk_Array8T bool false true true true false false false true - | x2 ⇒ mk_Array8T bool false true true true false false true false - | x3 ⇒ mk_Array8T bool false true true true false false true true - | x4 ⇒ mk_Array8T bool false true true true false true false false - | x5 ⇒ mk_Array8T bool false true true true false true false true - | x6 ⇒ mk_Array8T bool false true true true false true true false - | x7 ⇒ mk_Array8T bool false true true true false true true true - | x8 ⇒ mk_Array8T bool false true true true true false false false - | x9 ⇒ mk_Array8T bool false true true true true false false true - | xA ⇒ mk_Array8T bool false true true true true false true false - | xB ⇒ mk_Array8T bool false true true true true false true true - | xC ⇒ mk_Array8T bool false true true true true true false false - | xD ⇒ mk_Array8T bool false true true true true true false true - | xE ⇒ mk_Array8T bool false true true true true true true false - | xF ⇒ mk_Array8T bool false true true true true true true true ] - | x8 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true false false false false false false false - | x1 ⇒ mk_Array8T bool true false false false false false false true - | x2 ⇒ mk_Array8T bool true false false false false false true false - | x3 ⇒ mk_Array8T bool true false false false false false true true - | x4 ⇒ mk_Array8T bool true false false false false true false false - | x5 ⇒ mk_Array8T bool true false false false false true false true - | x6 ⇒ mk_Array8T bool true false false false false true true false - | x7 ⇒ mk_Array8T bool true false false false false true true true - | x8 ⇒ mk_Array8T bool true false false false true false false false - | x9 ⇒ mk_Array8T bool true false false false true false false true - | xA ⇒ mk_Array8T bool true false false false true false true false - | xB ⇒ mk_Array8T bool true false false false true false true true - | xC ⇒ mk_Array8T bool true false false false true true false false - | xD ⇒ mk_Array8T bool true false false false true true false true - | xE ⇒ mk_Array8T bool true false false false true true true false - | xF ⇒ mk_Array8T bool true false false false true true true true ] - | x9 ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true false false true false false false false - | x1 ⇒ mk_Array8T bool true false false true false false false true - | x2 ⇒ mk_Array8T bool true false false true false false true false - | x3 ⇒ mk_Array8T bool true false false true false false true true - | x4 ⇒ mk_Array8T bool true false false true false true false false - | x5 ⇒ mk_Array8T bool true false false true false true false true - | x6 ⇒ mk_Array8T bool true false false true false true true false - | x7 ⇒ mk_Array8T bool true false false true false true true true - | x8 ⇒ mk_Array8T bool true false false true true false false false - | x9 ⇒ mk_Array8T bool true false false true true false false true - | xA ⇒ mk_Array8T bool true false false true true false true false - | xB ⇒ mk_Array8T bool true false false true true false true true - | xC ⇒ mk_Array8T bool true false false true true true false false - | xD ⇒ mk_Array8T bool true false false true true true false true - | xE ⇒ mk_Array8T bool true false false true true true true false - | xF ⇒ mk_Array8T bool true false false true true true true true ] - | xA ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true false true false false false false false - | x1 ⇒ mk_Array8T bool true false true false false false false true - | x2 ⇒ mk_Array8T bool true false true false false false true false - | x3 ⇒ mk_Array8T bool true false true false false false true true - | x4 ⇒ mk_Array8T bool true false true false false true false false - | x5 ⇒ mk_Array8T bool true false true false false true false true - | x6 ⇒ mk_Array8T bool true false true false false true true false - | x7 ⇒ mk_Array8T bool true false true false false true true true - | x8 ⇒ mk_Array8T bool true false true false true false false false - | x9 ⇒ mk_Array8T bool true false true false true false false true - | xA ⇒ mk_Array8T bool true false true false true false true false - | xB ⇒ mk_Array8T bool true false true false true false true true - | xC ⇒ mk_Array8T bool true false true false true true false false - | xD ⇒ mk_Array8T bool true false true false true true false true - | xE ⇒ mk_Array8T bool true false true false true true true false - | xF ⇒ mk_Array8T bool true false true false true true true true ] - | xB ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true false true true false false false false - | x1 ⇒ mk_Array8T bool true false true true false false false true - | x2 ⇒ mk_Array8T bool true false true true false false true false - | x3 ⇒ mk_Array8T bool true false true true false false true true - | x4 ⇒ mk_Array8T bool true false true true false true false false - | x5 ⇒ mk_Array8T bool true false true true false true false true - | x6 ⇒ mk_Array8T bool true false true true false true true false - | x7 ⇒ mk_Array8T bool true false true true false true true true - | x8 ⇒ mk_Array8T bool true false true true true false false false - | x9 ⇒ mk_Array8T bool true false true true true false false true - | xA ⇒ mk_Array8T bool true false true true true false true false - | xB ⇒ mk_Array8T bool true false true true true false true true - | xC ⇒ mk_Array8T bool true false true true true true false false - | xD ⇒ mk_Array8T bool true false true true true true false true - | xE ⇒ mk_Array8T bool true false true true true true true false - | xF ⇒ mk_Array8T bool true false true true true true true true ] - | xC ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true true false false false false false false - | x1 ⇒ mk_Array8T bool true true false false false false false true - | x2 ⇒ mk_Array8T bool true true false false false false true false - | x3 ⇒ mk_Array8T bool true true false false false false true true - | x4 ⇒ mk_Array8T bool true true false false false true false false - | x5 ⇒ mk_Array8T bool true true false false false true false true - | x6 ⇒ mk_Array8T bool true true false false false true true false - | x7 ⇒ mk_Array8T bool true true false false false true true true - | x8 ⇒ mk_Array8T bool true true false false true false false false - | x9 ⇒ mk_Array8T bool true true false false true false false true - | xA ⇒ mk_Array8T bool true true false false true false true false - | xB ⇒ mk_Array8T bool true true false false true false true true - | xC ⇒ mk_Array8T bool true true false false true true false false - | xD ⇒ mk_Array8T bool true true false false true true false true - | xE ⇒ mk_Array8T bool true true false false true true true false - | xF ⇒ mk_Array8T bool true true false false true true true true ] - | xD ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true true false true false false false false - | x1 ⇒ mk_Array8T bool true true false true false false false true - | x2 ⇒ mk_Array8T bool true true false true false false true false - | x3 ⇒ mk_Array8T bool true true false true false false true true - | x4 ⇒ mk_Array8T bool true true false true false true false false - | x5 ⇒ mk_Array8T bool true true false true false true false true - | x6 ⇒ mk_Array8T bool true true false true false true true false - | x7 ⇒ mk_Array8T bool true true false true false true true true - | x8 ⇒ mk_Array8T bool true true false true true false false false - | x9 ⇒ mk_Array8T bool true true false true true false false true - | xA ⇒ mk_Array8T bool true true false true true false true false - | xB ⇒ mk_Array8T bool true true false true true false true true - | xC ⇒ mk_Array8T bool true true false true true true false false - | xD ⇒ mk_Array8T bool true true false true true true false true - | xE ⇒ mk_Array8T bool true true false true true true true false - | xF ⇒ mk_Array8T bool true true false true true true true true ] - | xE ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true true true false false false false false - | x1 ⇒ mk_Array8T bool true true true false false false false true - | x2 ⇒ mk_Array8T bool true true true false false false true false - | x3 ⇒ mk_Array8T bool true true true false false false true true - | x4 ⇒ mk_Array8T bool true true true false false true false false - | x5 ⇒ mk_Array8T bool true true true false false true false true - | x6 ⇒ mk_Array8T bool true true true false false true true false - | x7 ⇒ mk_Array8T bool true true true false false true true true - | x8 ⇒ mk_Array8T bool true true true false true false false false - | x9 ⇒ mk_Array8T bool true true true false true false false true - | xA ⇒ mk_Array8T bool true true true false true false true false - | xB ⇒ mk_Array8T bool true true true false true false true true - | xC ⇒ mk_Array8T bool true true true false true true false false - | xD ⇒ mk_Array8T bool true true true false true true false true - | xE ⇒ mk_Array8T bool true true true false true true true false - | xF ⇒ mk_Array8T bool true true true false true true true true ] - | xF ⇒ match b8l p with - [ x0 ⇒ mk_Array8T bool true true true true false false false false - | x1 ⇒ mk_Array8T bool true true true true false false false true - | x2 ⇒ mk_Array8T bool true true true true false false true false - | x3 ⇒ mk_Array8T bool true true true true false false true true - | x4 ⇒ mk_Array8T bool true true true true false true false false - | x5 ⇒ mk_Array8T bool true true true true false true false true - | x6 ⇒ mk_Array8T bool true true true true false true true false - | x7 ⇒ mk_Array8T bool true true true true false true true true - | x8 ⇒ mk_Array8T bool true true true true true false false false - | x9 ⇒ mk_Array8T bool true true true true true false false true - | xA ⇒ mk_Array8T bool true true true true true false true false - | xB ⇒ mk_Array8T bool true true true true true false true true - | xC ⇒ mk_Array8T bool true true true true true true false false - | xD ⇒ mk_Array8T bool true true true true true true false true - | xE ⇒ mk_Array8T bool true true true true true true true false - | xF ⇒ mk_Array8T bool true true true true true true true true ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/memory/memory_trees.ma b/helm/software/matita/contribs/ng_assembly/memory/memory_trees.ma deleted file mode 100755 index b2f2a0d35..000000000 --- a/helm/software/matita/contribs/ng_assembly/memory/memory_trees.ma +++ /dev/null @@ -1,148 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "memory/memory_struct.ma". -include "num/word32.ma". -include "common/option.ma". -include "common/list.ma". - -(* ********************* *) -(* MEMORIA E DESCRITTORE *) -(* ********************* *) - -ndefinition aux_32B_filler ≝ -λT:Type.λel:T. -let lev8 ≝ mk_Array16T T el el el el el el el el el el el el el el el el in -let lev7 ≝ mk_Array16T ? - lev8 lev8 lev8 lev8 lev8 lev8 lev8 lev8 - lev8 lev8 lev8 lev8 lev8 lev8 lev8 lev8 - in -let lev6 ≝ mk_Array16T ? - lev7 lev7 lev7 lev7 lev7 lev7 lev7 lev7 - lev7 lev7 lev7 lev7 lev7 lev7 lev7 lev7 - in -let lev5 ≝ mk_Array16T ? - lev6 lev6 lev6 lev6 lev6 lev6 lev6 lev6 - lev6 lev6 lev6 lev6 lev6 lev6 lev6 lev6 - in -let lev4 ≝ mk_Array16T ? - lev5 lev5 lev5 lev5 lev5 lev5 lev5 lev5 - lev5 lev5 lev5 lev5 lev5 lev5 lev5 lev5 - in -let lev3 ≝ mk_Array16T ? - lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 - lev4 lev4 lev4 lev4 lev4 lev4 lev4 lev4 - in -let lev2 ≝ mk_Array16T ? - lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 - lev3 lev3 lev3 lev3 lev3 lev3 lev3 lev3 - in -let lev1 ≝ mk_Array16T ? - lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 - lev2 lev2 lev2 lev2 lev2 lev2 lev2 lev2 - in -lev1. - -ndefinition aux_32B_type ≝ -λT:Type.Array16T (Array16T (Array16T (Array16T (Array16T (Array16T (Array16T (Array16T T))))))). - -(* tutta la memoria non installata *) -ndefinition mt_out_of_bound_memory ≝ aux_32B_filler ? MEM_OUT_OF_BOUND. - -(* tutta la memoria a 0 *) -ndefinition mt_zero_memory ≝ aux_32B_filler ? 〈x0,x0〉. - -(* visita di un albero da 4GB di elementi: ln16(4GB)=8 passaggi *) -ndefinition mt_visit ≝ -λT:Type.λdata:aux_32B_type T.λaddr:word32. - getn_array16T (b8l (w16l (w32l addr))) ? - (getn_array16T (b8h (w16l (w32l addr))) ? - (getn_array16T (b8l (w16h (w32l addr))) ? - (getn_array16T (b8h (w16h (w32l addr))) ? - (getn_array16T (b8l (w16l (w32h addr))) ? - (getn_array16T (b8h (w16l (w32h addr))) ? - (getn_array16T (b8l (w16h (w32h addr))) ? - (getn_array16T (b8h (w16h (w32h addr))) ? data))))))). - -(* scrittura di un elemento in un albero da 4GB *) -ndefinition mt_update ≝ -λT:Type.λdata:aux_32B_type T.λaddr:word32.λv:T. - let lev2 ≝ getn_array16T (b8h (w16h (w32h addr))) ? data in - let lev3 ≝ getn_array16T (b8l (w16h (w32h addr))) ? lev2 in - let lev4 ≝ getn_array16T (b8h (w16l (w32h addr))) ? lev3 in - let lev5 ≝ getn_array16T (b8l (w16l (w32h addr))) ? lev4 in - let lev6 ≝ getn_array16T (b8h (w16h (w32l addr))) ? lev5 in - let lev7 ≝ getn_array16T (b8l (w16h (w32l addr))) ? lev6 in - let lev8 ≝ getn_array16T (b8h (w16l (w32l addr))) ? lev7 in - - setn_array16T (b8h (w16h (w32h addr))) ? data - (setn_array16T (b8l (w16h (w32h addr))) ? lev2 - (setn_array16T (b8h (w16l (w32h addr))) ? lev3 - (setn_array16T (b8l (w16l (w32h addr))) ? lev4 - (setn_array16T (b8h (w16h (w32l addr))) ? lev5 - (setn_array16T (b8l (w16h (w32l addr))) ? lev6 - (setn_array16T (b8h (w16l (w32l addr))) ? lev7 - (setn_array16T (b8l (w16l (w32l addr))) T lev8 v))))))). - -(* scrittura di un range (max 64KB) in un albero da 4GB *) -nlet rec mt_update_ranged (T:Type) (data:aux_32B_type T) (addr:word32) (w:word16) (rw:rec_word16 w) (v:T) on rw ≝ - match rw with - [ w16_O ⇒ data - | w16_S w' rw' ⇒ mt_update_ranged T (mt_update T data addr v) - (succ_w32 addr) w' rw' v - ]. - -(* scrivi controllando il tipo di memoria *) -ndefinition mt_mem_update ≝ -λmem:aux_32B_type byte8. -λchk:aux_32B_type memory_type. -λaddr:word32.λv:byte8. - match mt_visit ? chk addr with - (* ROM? ok, ma il valore viene perso *) - [ MEM_READ_ONLY ⇒ Some ? mem - (* RAM? ok *) - | MEM_READ_WRITE ⇒ Some ? (mt_update ? mem addr v) - (* NON INSTALLATA? no *) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -(* leggi controllando il tipo di memoria *) -ndefinition mt_mem_read ≝ -λmem:aux_32B_type byte8. -λchk:aux_32B_type memory_type. -λaddr:word32. - match mt_visit ? chk addr with - [ MEM_READ_ONLY ⇒ Some ? (mt_visit ? mem addr) - | MEM_READ_WRITE ⇒ Some ? (mt_visit ? mem addr) - | MEM_OUT_OF_BOUND ⇒ None ? ]. - -(* ************************** *) -(* CARICAMENTO PROGRAMMA/DATI *) -(* ************************** *) - -(* carica a paratire da addr, overflow se si supera 0xFFFF... *) -nlet rec mt_load_from_source_at (old_mem:aux_32B_type byte8) - (src:list byte8) (addr:word32) on src ≝ - match src with - (* fine di source: carica da old_mem *) - [ nil ⇒ old_mem - | cons hd tl ⇒ mt_load_from_source_at (mt_update ? old_mem addr hd) tl (succ_w32 addr) - ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/bitrigesim.ma b/helm/software/matita/contribs/ng_assembly/num/bitrigesim.ma deleted file mode 100755 index fdfb9fbd2..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/bitrigesim.ma +++ /dev/null @@ -1,189 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ************* *) -(* BITRIGESIMALI *) -(* ************* *) - -ninductive bitrigesim : Type ≝ - t00: bitrigesim -| t01: bitrigesim -| t02: bitrigesim -| t03: bitrigesim -| t04: bitrigesim -| t05: bitrigesim -| t06: bitrigesim -| t07: bitrigesim -| t08: bitrigesim -| t09: bitrigesim -| t0A: bitrigesim -| t0B: bitrigesim -| t0C: bitrigesim -| t0D: bitrigesim -| t0E: bitrigesim -| t0F: bitrigesim -| t10: bitrigesim -| t11: bitrigesim -| t12: bitrigesim -| t13: bitrigesim -| t14: bitrigesim -| t15: bitrigesim -| t16: bitrigesim -| t17: bitrigesim -| t18: bitrigesim -| t19: bitrigesim -| t1A: bitrigesim -| t1B: bitrigesim -| t1C: bitrigesim -| t1D: bitrigesim -| t1E: bitrigesim -| t1F: bitrigesim. - -(* operatore = *) -ndefinition eq_bit ≝ -λt1,t2:bitrigesim. - match t1 with - [ t00 ⇒ match t2 with [ t00 ⇒ true | _ ⇒ false ] | t01 ⇒ match t2 with [ t01 ⇒ true | _ ⇒ false ] - | t02 ⇒ match t2 with [ t02 ⇒ true | _ ⇒ false ] | t03 ⇒ match t2 with [ t03 ⇒ true | _ ⇒ false ] - | t04 ⇒ match t2 with [ t04 ⇒ true | _ ⇒ false ] | t05 ⇒ match t2 with [ t05 ⇒ true | _ ⇒ false ] - | t06 ⇒ match t2 with [ t06 ⇒ true | _ ⇒ false ] | t07 ⇒ match t2 with [ t07 ⇒ true | _ ⇒ false ] - | t08 ⇒ match t2 with [ t08 ⇒ true | _ ⇒ false ] | t09 ⇒ match t2 with [ t09 ⇒ true | _ ⇒ false ] - | t0A ⇒ match t2 with [ t0A ⇒ true | _ ⇒ false ] | t0B ⇒ match t2 with [ t0B ⇒ true | _ ⇒ false ] - | t0C ⇒ match t2 with [ t0C ⇒ true | _ ⇒ false ] | t0D ⇒ match t2 with [ t0D ⇒ true | _ ⇒ false ] - | t0E ⇒ match t2 with [ t0E ⇒ true | _ ⇒ false ] | t0F ⇒ match t2 with [ t0F ⇒ true | _ ⇒ false ] - | t10 ⇒ match t2 with [ t10 ⇒ true | _ ⇒ false ] | t11 ⇒ match t2 with [ t11 ⇒ true | _ ⇒ false ] - | t12 ⇒ match t2 with [ t12 ⇒ true | _ ⇒ false ] | t13 ⇒ match t2 with [ t13 ⇒ true | _ ⇒ false ] - | t14 ⇒ match t2 with [ t14 ⇒ true | _ ⇒ false ] | t15 ⇒ match t2 with [ t15 ⇒ true | _ ⇒ false ] - | t16 ⇒ match t2 with [ t16 ⇒ true | _ ⇒ false ] | t17 ⇒ match t2 with [ t17 ⇒ true | _ ⇒ false ] - | t18 ⇒ match t2 with [ t18 ⇒ true | _ ⇒ false ] | t19 ⇒ match t2 with [ t19 ⇒ true | _ ⇒ false ] - | t1A ⇒ match t2 with [ t1A ⇒ true | _ ⇒ false ] | t1B ⇒ match t2 with [ t1B ⇒ true | _ ⇒ false ] - | t1C ⇒ match t2 with [ t1C ⇒ true | _ ⇒ false ] | t1D ⇒ match t2 with [ t1D ⇒ true | _ ⇒ false ] - | t1E ⇒ match t2 with [ t1E ⇒ true | _ ⇒ false ] | t1F ⇒ match t2 with [ t1F ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sui bitrigesimali *) -ndefinition forall_bit ≝ λP. - P t00 ⊗ P t01 ⊗ P t02 ⊗ P t03 ⊗ P t04 ⊗ P t05 ⊗ P t06 ⊗ P t07 ⊗ - P t08 ⊗ P t09 ⊗ P t0A ⊗ P t0B ⊗ P t0C ⊗ P t0D ⊗ P t0E ⊗ P t0F ⊗ - P t10 ⊗ P t11 ⊗ P t12 ⊗ P t13 ⊗ P t14 ⊗ P t15 ⊗ P t16 ⊗ P t17 ⊗ - P t18 ⊗ P t19 ⊗ P t1A ⊗ P t1B ⊗ P t1C ⊗ P t1D ⊗ P t1E ⊗ P t1F. - -(* operatore successore *) -ndefinition succ_bit ≝ -λn.match n with - [ t00 ⇒ t01 | t01 ⇒ t02 | t02 ⇒ t03 | t03 ⇒ t04 | t04 ⇒ t05 | t05 ⇒ t06 | t06 ⇒ t07 | t07 ⇒ t08 - | t08 ⇒ t09 | t09 ⇒ t0A | t0A ⇒ t0B | t0B ⇒ t0C | t0C ⇒ t0D | t0D ⇒ t0E | t0E ⇒ t0F | t0F ⇒ t10 - | t10 ⇒ t11 | t11 ⇒ t12 | t12 ⇒ t13 | t13 ⇒ t14 | t14 ⇒ t15 | t15 ⇒ t16 | t16 ⇒ t17 | t17 ⇒ t18 - | t18 ⇒ t19 | t19 ⇒ t1A | t1A ⇒ t1B | t1B ⇒ t1C | t1C ⇒ t1D | t1D ⇒ t1E | t1E ⇒ t1F | t1F ⇒ t00 - ]. - -(* bitrigesimali ricorsivi *) -ninductive rec_bitrigesim : bitrigesim → Type ≝ - bi_O : rec_bitrigesim t00 -| bi_S : ∀n.rec_bitrigesim n → rec_bitrigesim (succ_bit n). - -(* bitrigesimali → bitrigesimali ricorsivi *) -ndefinition bit_to_recbit ≝ -λn.match n return λx.rec_bitrigesim x with - [ t00 ⇒ bi_O - | t01 ⇒ bi_S ? bi_O - | t02 ⇒ bi_S ? (bi_S ? bi_O) - | t03 ⇒ bi_S ? (bi_S ? (bi_S ? bi_O)) - | t04 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))) - | t05 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))) - | t06 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))) - | t07 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))) - | t08 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - bi_O))))))) - | t09 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? bi_O)))))))) - | t0A ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? bi_O))))))))) - | t0B ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))) - | t0C ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))) - | t0D ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))) - | t0E ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))))) - | t0F ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))) - | t10 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - bi_O))))))))))))))) - | t11 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? bi_O)))))))))))))))) - | t12 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? bi_O))))))))))))))))) - | t13 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))) - | t14 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))))))))))) - | t15 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))))) - | t16 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))))))))))))) - | t17 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))))))) - | t18 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - bi_O))))))))))))))))))))))) - | t19 ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? bi_O)))))))))))))))))))))))) - | t1A ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? bi_O))))))))))))))))))))))))) - | t1B ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))))))))))) - | t1C ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))))))))))))))))))) - | t1D ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))))))))))))) - | t1E ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O))))))))))))))))))))))))))))) - | t1F ⇒ bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? - (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? (bi_S ? bi_O)))))))))))))))))))))))))))))) - ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/bitrigesim_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/bitrigesim_lemmas.ma deleted file mode 100755 index 021563e94..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/bitrigesim_lemmas.ma +++ /dev/null @@ -1,137 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bitrigesim.ma". -include "num/bool_lemmas.ma". - -(* ************* *) -(* BITRIGESIMALI *) -(* ************* *) - -(* -ndefinition bitrigesim_destruct_aux ≝ -Πt1,t2:bitrigesim.ΠP:Prop.t1 = t2 → - match eq_bit t1 t2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition bitrigesim_destruct : bitrigesim_destruct_aux. - #t1; #t2; #P; #H; - nrewrite < H; - nelim t1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma eq_to_eqbit : ∀n1,n2.n1 = n2 → eq_bit n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqbit_to_neq : ∀n1,n2.eq_bit n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_bit n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqbit n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqbit_to_eq1 : ∀t2.eq_bit t00 t2 = true → t00 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##1: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq2 : ∀t2.eq_bit t01 t2 = true → t01 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##2: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq3 : ∀t2.eq_bit t02 t2 = true → t02 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##3: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq4 : ∀t2.eq_bit t03 t2 = true → t03 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##4: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq5 : ∀t2.eq_bit t04 t2 = true → t04 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##5: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq6 : ∀t2.eq_bit t05 t2 = true → t05 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##6: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq7 : ∀t2.eq_bit t06 t2 = true → t06 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##7: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq8 : ∀t2.eq_bit t07 t2 = true → t07 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##8: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq9 : ∀t2.eq_bit t08 t2 = true → t08 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##9: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq10 : ∀t2.eq_bit t09 t2 = true → t09 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##10: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq11 : ∀t2.eq_bit t0A t2 = true → t0A = t2. #t2; ncases t2; nnormalize; #H; ##[ ##11: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq12 : ∀t2.eq_bit t0B t2 = true → t0B = t2. #t2; ncases t2; nnormalize; #H; ##[ ##12: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq13 : ∀t2.eq_bit t0C t2 = true → t0C = t2. #t2; ncases t2; nnormalize; #H; ##[ ##13: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq14 : ∀t2.eq_bit t0D t2 = true → t0D = t2. #t2; ncases t2; nnormalize; #H; ##[ ##14: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq15 : ∀t2.eq_bit t0E t2 = true → t0E = t2. #t2; ncases t2; nnormalize; #H; ##[ ##15: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq16 : ∀t2.eq_bit t0F t2 = true → t0F = t2. #t2; ncases t2; nnormalize; #H; ##[ ##16: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq17 : ∀t2.eq_bit t10 t2 = true → t10 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##17: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq18 : ∀t2.eq_bit t11 t2 = true → t11 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##18: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq19 : ∀t2.eq_bit t12 t2 = true → t12 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##19: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq20 : ∀t2.eq_bit t13 t2 = true → t13 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##20: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq21 : ∀t2.eq_bit t14 t2 = true → t14 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##21: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq22 : ∀t2.eq_bit t15 t2 = true → t15 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##22: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq23 : ∀t2.eq_bit t16 t2 = true → t16 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##23: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq24 : ∀t2.eq_bit t17 t2 = true → t17 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##24: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq25 : ∀t2.eq_bit t18 t2 = true → t18 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##25: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq26 : ∀t2.eq_bit t19 t2 = true → t19 = t2. #t2; ncases t2; nnormalize; #H; ##[ ##26: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq27 : ∀t2.eq_bit t1A t2 = true → t1A = t2. #t2; ncases t2; nnormalize; #H; ##[ ##27: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq28 : ∀t2.eq_bit t1B t2 = true → t1B = t2. #t2; ncases t2; nnormalize; #H; ##[ ##28: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq29 : ∀t2.eq_bit t1C t2 = true → t1C = t2. #t2; ncases t2; nnormalize; #H; ##[ ##29: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq30 : ∀t2.eq_bit t1D t2 = true → t1D = t2. #t2; ncases t2; nnormalize; #H; ##[ ##30: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq31 : ∀t2.eq_bit t1E t2 = true → t1E = t2. #t2; ncases t2; nnormalize; #H; ##[ ##31: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. -nlemma eqbit_to_eq32 : ∀t2.eq_bit t1F t2 = true → t1F = t2. #t2; ncases t2; nnormalize; #H; ##[ ##32: napply refl_eq ##| ##*: ndestruct (*napply (bool_destruct … H)*) ##] nqed. - -nlemma eqbit_to_eq : ∀t1,t2.eq_bit t1 t2 = true → t1 = t2. - #t1; ncases t1; - ##[ ##1: napply eqbit_to_eq1 ##| ##2: napply eqbit_to_eq2 - ##| ##3: napply eqbit_to_eq3 ##| ##4: napply eqbit_to_eq4 - ##| ##5: napply eqbit_to_eq5 ##| ##6: napply eqbit_to_eq6 - ##| ##7: napply eqbit_to_eq7 ##| ##8: napply eqbit_to_eq8 - ##| ##9: napply eqbit_to_eq9 ##| ##10: napply eqbit_to_eq10 - ##| ##11: napply eqbit_to_eq11 ##| ##12: napply eqbit_to_eq12 - ##| ##13: napply eqbit_to_eq13 ##| ##14: napply eqbit_to_eq14 - ##| ##15: napply eqbit_to_eq15 ##| ##16: napply eqbit_to_eq16 - ##| ##17: napply eqbit_to_eq17 ##| ##18: napply eqbit_to_eq18 - ##| ##19: napply eqbit_to_eq19 ##| ##20: napply eqbit_to_eq20 - ##| ##21: napply eqbit_to_eq21 ##| ##22: napply eqbit_to_eq22 - ##| ##23: napply eqbit_to_eq23 ##| ##24: napply eqbit_to_eq24 - ##| ##25: napply eqbit_to_eq25 ##| ##26: napply eqbit_to_eq26 - ##| ##27: napply eqbit_to_eq27 ##| ##28: napply eqbit_to_eq28 - ##| ##29: napply eqbit_to_eq29 ##| ##30: napply eqbit_to_eq30 - ##| ##31: napply eqbit_to_eq31 ##| ##32: napply eqbit_to_eq32 - ##] -nqed. - -nlemma neq_to_neqbit : ∀n1,n2.n1 ≠ n2 → eq_bit n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_bit n1 n2)); - napply (not_to_not (eq_bit n1 n2 = true) (n1 = n2) ? H); - napply (eqbit_to_eq n1 n2). -nqed. - -nlemma decidable_bit : ∀x,y:bitrigesim.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_bit x y = true) (eq_bit x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqbit_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqbit_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqbit : symmetricT bitrigesim bool eq_bit. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_bit n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqbit n1 n2 H); - napply (symmetric_eq ? (eq_bit n2 n1) false); - napply (neq_to_neqbit n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/bool.ma b/helm/software/matita/contribs/ng_assembly/num/bool.ma deleted file mode 100755 index 8092713f2..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/bool.ma +++ /dev/null @@ -1,78 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/theory.ma". - -(* ******** *) -(* BOOLEANI *) -(* ******** *) - -ninductive bool : Type ≝ - true : bool -| false : bool. - -(* operatori booleani *) - -ndefinition eq_bool ≝ -λb1,b2:bool.match b1 with - [ true ⇒ match b2 with [ true ⇒ true | false ⇒ false ] - | false ⇒ match b2 with [ true ⇒ false | false ⇒ true ] - ]. - -ndefinition not_bool ≝ -λb:bool.match b with [ true ⇒ false | false ⇒ true ]. - -ndefinition and_bool ≝ -λb1,b2:bool.match b1 with - [ true ⇒ b2 | false ⇒ false ]. - -ndefinition or_bool ≝ -λb1,b2:bool.match b1 with - [ true ⇒ true | false ⇒ b2 ]. - -ndefinition xor_bool ≝ -λb1,b2:bool.match b1 with - [ true ⇒ not_bool b2 - | false ⇒ b2 ]. - -(* \ominus *) -notation "hvbox(⊖ a)" non associative with precedence 36 - for @{ 'not_bool $a }. -interpretation "not_bool" 'not_bool x = (not_bool x). - -(* \otimes *) -notation "hvbox(a break ⊗ b)" left associative with precedence 35 - for @{ 'and_bool $a $b }. -interpretation "and_bool" 'and_bool x y = (and_bool x y). - -(* \oplus *) -notation "hvbox(a break ⊕ b)" left associative with precedence 34 - for @{ 'or_bool $a $b }. -interpretation "or_bool" 'or_bool x y = (or_bool x y). - -(* \odot *) -notation "hvbox(a break ⊙ b)" left associative with precedence 33 - for @{ 'xor_bool $a $b }. -interpretation "xor_bool" 'xor_bool x y = (xor_bool x y). - -ndefinition boolRelation : Type → Type ≝ -λA:Type.A → A → bool. diff --git a/helm/software/matita/contribs/ng_assembly/num/bool_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/bool_lemmas.ma deleted file mode 100755 index db5214c6d..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/bool_lemmas.ma +++ /dev/null @@ -1,324 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ******** *) -(* BOOLEANI *) -(* ******** *) - -(* -ndefinition bool_destruct_aux ≝ -Πb1,b2:bool.ΠP:Prop.b1 = b2 → - match eq_bool b1 b2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition bool_destruct : bool_destruct_aux. - #b1; #b2; #P; #H; - nrewrite < H; - nelim b1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma symmetric_eqbool : symmetricT bool bool eq_bool. - #b1; #b2; - nelim b1; - nelim b2; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_andbool : symmetricT bool bool and_bool. - #b1; #b2; - nelim b1; - nelim b2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_andbool : ∀b1,b2,b3.((b1 ⊗ b2) ⊗ b3) = (b1 ⊗ (b2 ⊗ b3)). - #b1; #b2; #b3; - nelim b1; - nelim b2; - nelim b3; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_orbool : symmetricT bool bool or_bool. - #b1; #b2; - nelim b1; - nelim b2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_orbool : ∀b1,b2,b3.((b1 ⊕ b2) ⊕ b3) = (b1 ⊕ (b2 ⊕ b3)). - #b1; #b2; #b3; - nelim b1; - nelim b2; - nelim b3; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_xorbool : symmetricT bool bool xor_bool. - #b1; #b2; - nelim b1; - nelim b2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_xorbool : ∀b1,b2,b3.((b1 ⊙ b2) ⊙ b3) = (b1 ⊙ (b2 ⊙ b3)). - #b1; #b2; #b3; - nelim b1; - nelim b2; - nelim b3; - nnormalize; - napply refl_eq. -nqed. - -nlemma eqbool_to_eq : ∀b1,b2:bool.(eq_bool b1 b2 = true) → (b1 = b2). - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,4: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma eq_to_eqbool : ∀b1,b2.b1 = b2 → eq_bool b1 b2 = true. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,4: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma decidable_bool : ∀x,y:bool.decidable (x = y). - #x; #y; - nnormalize; - nelim x; - nelim y; - ##[ ##1,4: napply (or2_intro1 (? = ?) (? ≠ ?) …); napply refl_eq - ##| ##*: napply (or2_intro2 (? = ?) (? ≠ ?) …); - nnormalize; #H; - napply False_ind; - ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma decidable_bexpr : ∀x.(x = true) ∨ (x = false). - #x; ncases x; - ##[ ##1: napply (or2_intro1 (true = true) (true = false) (refl_eq …)) - ##| ##2: napply (or2_intro2 (false = true) (false = false) (refl_eq …)) - ##] -nqed. - -nlemma neqbool_to_neq : ∀b1,b2:bool.(eq_bool b1 b2 = false) → (b1 ≠ b2). - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,4: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##*: #H; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##] -nqed. - -nlemma neq_to_neqbool : ∀b1,b2.b1 ≠ b2 → eq_bool b1 b2 = false. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,4: #H; nelim (H (refl_eq …)) - ##| ##*: #H; napply refl_eq - ##] -nqed. - -nlemma eqfalse_to_neqtrue : ∀x.x = false → x ≠ true. - #x; nelim x; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##2: #H; nnormalize; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##] -nqed. - -nlemma eqtrue_to_neqfalse : ∀x.x = true → x ≠ false. - #x; nelim x; - ##[ ##1: #H; nnormalize; #H1; ndestruct (*napply (bool_destruct … H1)*) - ##| ##2: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma neqfalse_to_eqtrue : ∀x.x ≠ false → x = true. - #x; nelim x; - ##[ ##1: #H; napply refl_eq - ##| ##2: nnormalize; #H; nelim (H (refl_eq …)) - ##] -nqed. - -nlemma neqtrue_to_eqfalse : ∀x.x ≠ true → x = false. - #x; nelim x; - ##[ ##1: nnormalize; #H; nelim (H (refl_eq …)) - ##| ##2: #H; napply refl_eq - ##] -nqed. - -nlemma andb_true_true_l: ∀b1,b2.(b1 ⊗ b2) = true → b1 = true. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,2: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma andb_true_true_r: ∀b1,b2.(b1 ⊗ b2) = true → b2 = true. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1,3: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma andb_false2 - : ∀b1,b2.(b1 ⊗ b2) = false → - (b1 = false) ∨ (b2 = false). - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##2,4: #H; napply (or2_intro2 … H) - ##| ##3: #H; napply (or2_intro1 … H) - ##] -nqed. - -nlemma andb_false3 - : ∀b1,b2,b3.(b1 ⊗ b2 ⊗ b3) = false → - Or3 (b1 = false) (b2 = false) (b3 = false). - #b1; #b2; #b3; - ncases b1; - ncases b2; - ncases b3; - nnormalize; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##5,6,7,8: #H; napply (or3_intro1 … H) - ##| ##2,4: #H; napply (or3_intro3 … H) - ##| ##3: #H; napply (or3_intro2 … H) - ##] -nqed. - -nlemma andb_false4 - : ∀b1,b2,b3,b4.(b1 ⊗ b2 ⊗ b3 ⊗ b4) = false → - Or4 (b1 = false) (b2 = false) (b3 = false) (b4 = false). - #b1; #b2; #b3; #b4; - ncases b1; - ncases b2; - ncases b3; - ncases b4; - nnormalize; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##9,10,11,12,13,14,15,16: #H; napply (or4_intro1 … H) - ##| ##5,6,7,8: #H; napply (or4_intro2 … H) - ##| ##3,4: #H; napply (or4_intro3 … H) - ##| ##2: #H; napply (or4_intro4 … H) - ##] -nqed. - -nlemma andb_false5 - : ∀b1,b2,b3,b4,b5.(b1 ⊗ b2 ⊗ b3 ⊗ b4 ⊗ b5) = false → - Or5 (b1 = false) (b2 = false) (b3 = false) (b4 = false) (b5 = false). - #b1; #b2; #b3; #b4; #b5; - ncases b1; - ncases b2; - ncases b3; - ncases b4; - ncases b5; - nnormalize; - ##[ ##1: #H; ndestruct (*napply (bool_destruct … H)*) - ##| ##17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32: #H; napply (or5_intro1 … H) - ##| ##9,10,11,12,13,14,15,16: #H; napply (or5_intro2 … H) - ##| ##5,6,7,8: #H; napply (or5_intro3 … H) - ##| ##3,4: #H; napply (or5_intro4 … H) - ##| ##2: #H; napply (or5_intro5 … H) - ##] -nqed. - -nlemma andb_false2_1 : ∀b.(false ⊗ b) = false. - #b; nnormalize; napply refl_eq. nqed. -nlemma andb_false2_2 : ∀b.(b ⊗ false) = false. - #b; nelim b; nnormalize; napply refl_eq. nqed. - -nlemma andb_false3_1 : ∀b1,b2.(false ⊗ b1 ⊗ b2) = false. - #b1; #b2; nnormalize; napply refl_eq. nqed. -nlemma andb_false3_2 : ∀b1,b2.(b1 ⊗ false ⊗ b2) = false. - #b1; #b2; nelim b1; nnormalize; napply refl_eq. nqed. -nlemma andb_false3_3 : ∀b1,b2.(b1 ⊗ b2 ⊗ false) = false. - #b1; #b2; nelim b1; nelim b2; nnormalize; napply refl_eq. nqed. - -nlemma andb_false4_1 : ∀b1,b2,b3.(false ⊗ b1 ⊗ b2 ⊗ b3) = false. - #b1; #b2; #b3; nnormalize; napply refl_eq. nqed. -nlemma andb_false4_2 : ∀b1,b2,b3.(b1 ⊗ false ⊗ b2 ⊗ b3) = false. - #b1; #b2; #b3; nelim b1; nnormalize; napply refl_eq. nqed. -nlemma andb_false4_3 : ∀b1,b2,b3.(b1 ⊗ b2 ⊗ false ⊗ b3) = false. - #b1; #b2; #b3; nelim b1; nelim b2; nnormalize; napply refl_eq. nqed. -nlemma andb_false4_4 : ∀b1,b2,b3.(b1 ⊗ b2 ⊗ b3 ⊗ false) = false. - #b1; #b2; #b3; nelim b1; nelim b2; nelim b3; nnormalize; napply refl_eq. nqed. - -nlemma andb_false5_1 : ∀b1,b2,b3,b4.(false ⊗ b1 ⊗ b2 ⊗ b3 ⊗ b4) = false. - #b1; #b2; #b3; #b4; nnormalize; napply refl_eq. nqed. -nlemma andb_false5_2 : ∀b1,b2,b3,b4.(b1 ⊗ false ⊗ b2 ⊗ b3 ⊗ b4) = false. - #b1; #b2; #b3; #b4; nelim b1; nnormalize; napply refl_eq. nqed. -nlemma andb_false5_3 : ∀b1,b2,b3,b4.(b1 ⊗ b2 ⊗ false ⊗ b3 ⊗ b4) = false. - #b1; #b2; #b3; #b4; nelim b1; nelim b2; nnormalize; napply refl_eq. nqed. -nlemma andb_false5_4 : ∀b1,b2,b3,b4.(b1 ⊗ b2 ⊗ b3 ⊗ false ⊗ b4) = false. - #b1; #b2; #b3; #b4; nelim b1; nelim b2; nelim b3; nnormalize; napply refl_eq. nqed. -nlemma andb_false5_5 : ∀b1,b2,b3,b4.(b1 ⊗ b2 ⊗ b3 ⊗ b4 ⊗ false) = false. - #b1; #b2; #b3; #b4; nelim b1; nelim b2; nelim b3; nelim b4; nnormalize; napply refl_eq. nqed. - -nlemma orb_false_false_l : ∀b1,b2:bool.(b1 ⊕ b2) = false → b1 = false. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##4: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma orb_false_false_r : ∀b1,b2:bool.(b1 ⊕ b2) = false → b2 = false. - #b1; #b2; - ncases b1; - ncases b2; - nnormalize; - ##[ ##4: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/byte8.ma b/helm/software/matita/contribs/ng_assembly/num/byte8.ma deleted file mode 100755 index d759181ce..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/byte8.ma +++ /dev/null @@ -1,408 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/exadecim.ma". -include "num/bitrigesim.ma". - -(* **** *) -(* BYTE *) -(* **** *) - -nrecord byte8 : Type ≝ - { - b8h: exadecim; - b8l: exadecim - }. - -(* \langle \rangle *) -notation "〈x,y〉" non associative with precedence 80 - for @{ 'mk_byte8 $x $y }. -interpretation "mk_byte8" 'mk_byte8 x y = (mk_byte8 x y). - -(* operatore = *) -ndefinition eq_b8 ≝ λb1,b2:byte8.(eq_ex (b8h b1) (b8h b2)) ⊗ (eq_ex (b8l b1) (b8l b2)). - -(* operatore < *) -ndefinition lt_b8 ≝ -λb1,b2:byte8. - (lt_ex (b8h b1) (b8h b2)) ⊕ - ((eq_ex (b8h b1) (b8h b2)) ⊗ (lt_ex (b8l b1) (b8l b2))). - -(* operatore ≤ *) -ndefinition le_b8 ≝ -λb1,b2:byte8. - (lt_ex (b8h b1) (b8h b2)) ⊕ - ((eq_ex (b8h b1) (b8h b2)) ⊗ (le_ex (b8l b1) (b8l b2))). - -(* operatore > *) -ndefinition gt_b8 ≝ -λb1,b2:byte8. - (gt_ex (b8h b1) (b8h b2)) ⊕ - ((eq_ex (b8h b1) (b8h b2)) ⊗ (gt_ex (b8l b1) (b8l b2))). - -(* operatore ≥ *) -ndefinition ge_b8 ≝ -λb1,b2:byte8. - (gt_ex (b8h b1) (b8h b2)) ⊕ - ((eq_ex (b8h b1) (b8h b2)) ⊗ (ge_ex (b8l b1) (b8l b2))). - -(* operatore and *) -ndefinition and_b8 ≝ -λb1,b2:byte8.mk_byte8 (and_ex (b8h b1) (b8h b2)) (and_ex (b8l b1) (b8l b2)). - -(* operatore or *) -ndefinition or_b8 ≝ -λb1,b2:byte8.mk_byte8 (or_ex (b8h b1) (b8h b2)) (or_ex (b8l b1) (b8l b2)). - -(* operatore xor *) -ndefinition xor_b8 ≝ -λb1,b2:byte8.mk_byte8 (xor_ex (b8h b1) (b8h b2)) (xor_ex (b8l b1) (b8l b2)). - -(* operatore rotazione destra con carry *) -ndefinition rcr_b8 ≝ -λb:byte8.λc:bool.match rcr_ex (b8h b) c with - [ pair bh' c' ⇒ match rcr_ex (b8l b) c' with - [ pair bl' c'' ⇒ pair … (mk_byte8 bh' bl') c'' ]]. - -(* operatore shift destro *) -ndefinition shr_b8 ≝ -λb:byte8.match rcr_ex (b8h b) false with - [ pair bh' c' ⇒ match rcr_ex (b8l b) c' with - [ pair bl' c'' ⇒ pair … (mk_byte8 bh' bl') c'' ]]. - -(* operatore rotazione destra *) -ndefinition ror_b8 ≝ -λb:byte8.match rcr_ex (b8h b) false with - [ pair bh' c' ⇒ match rcr_ex (b8l b) c' with - [ pair bl' c'' ⇒ match c'' with - [ true ⇒ mk_byte8 (or_ex x8 bh') bl' - | false ⇒ mk_byte8 bh' bl' ]]]. - -(* operatore rotazione destra n-volte *) -nlet rec ror_b8_n (b:byte8) (n:nat) on n ≝ - match n with - [ O ⇒ b - | S n' ⇒ ror_b8_n (ror_b8 b) n' ]. - -(* operatore rotazione sinistra con carry *) -ndefinition rcl_b8 ≝ -λb:byte8.λc:bool.match rcl_ex (b8l b) c with - [ pair bl' c' ⇒ match rcl_ex (b8h b) c' with - [ pair bh' c'' ⇒ pair … (mk_byte8 bh' bl') c'' ]]. - -(* operatore shift sinistro *) -ndefinition shl_b8 ≝ -λb:byte8.match rcl_ex (b8l b) false with - [ pair bl' c' ⇒ match rcl_ex (b8h b) c' with - [ pair bh' c'' ⇒ pair … (mk_byte8 bh' bl') c'' ]]. - -(* operatore rotazione sinistra *) -ndefinition rol_b8 ≝ -λb:byte8.match rcl_ex (b8l b) false with - [ pair bl' c' ⇒ match rcl_ex (b8h b) c' with - [ pair bh' c'' ⇒ match c'' with - [ true ⇒ mk_byte8 bh' (or_ex x1 bl') - | false ⇒ mk_byte8 bh' bl' ]]]. - -(* operatore rotazione sinistra n-volte *) -nlet rec rol_b8_n (b:byte8) (n:nat) on n ≝ - match n with - [ O ⇒ b - | S n' ⇒ rol_b8_n (rol_b8 b) n' ]. - -(* operatore not/complemento a 1 *) -ndefinition not_b8 ≝ -λb:byte8.mk_byte8 (not_ex (b8h b)) (not_ex (b8l b)). - -(* operatore somma con data+carry → data+carry *) -ndefinition plus_b8_dc_dc ≝ -λb1,b2:byte8.λc:bool. - match plus_ex_dc_dc (b8l b1) (b8l b2) c with - [ pair l c ⇒ match plus_ex_dc_dc (b8h b1) (b8h b2) c with - [ pair h c' ⇒ pair … 〈h,l〉 c' ]]. - -(* operatore somma con data+carry → data *) -ndefinition plus_b8_dc_d ≝ -λb1,b2:byte8.λc:bool. - match plus_ex_dc_dc (b8l b1) (b8l b2) c with - [ pair l c ⇒ 〈plus_ex_dc_d (b8h b1) (b8h b2) c,l〉 ]. - -(* operatore somma con data+carry → c *) -ndefinition plus_b8_dc_c ≝ -λb1,b2:byte8.λc:bool. - plus_ex_dc_c (b8h b1) (b8h b2) (plus_ex_dc_c (b8l b1) (b8l b2) c). - -(* operatore somma con data → data+carry *) -ndefinition plus_b8_d_dc ≝ -λb1,b2:byte8. - match plus_ex_d_dc (b8l b1) (b8l b2) with - [ pair l c ⇒ match plus_ex_dc_dc (b8h b1) (b8h b2) c with - [ pair h c' ⇒ pair … 〈h,l〉 c' ]]. - -(* operatore somma con data → data *) -ndefinition plus_b8_d_d ≝ -λb1,b2:byte8. - match plus_ex_d_dc (b8l b1) (b8l b2) with - [ pair l c ⇒ 〈plus_ex_dc_d (b8h b1) (b8h b2) c,l〉 ]. - -(* operatore somma con data → c *) -ndefinition plus_b8_d_c ≝ -λb1,b2:byte8. - plus_ex_dc_c (b8h b1) (b8h b2) (plus_ex_d_c (b8l b1) (b8l b2)). - -(* operatore Most Significant Bit *) -ndefinition MSB_b8 ≝ λb:byte8.eq_ex x8 (and_ex x8 (b8h b)). - -(* operatore predecessore *) -ndefinition pred_b8 ≝ -λb:byte8.match eq_ex (b8l b) x0 with - [ true ⇒ mk_byte8 (pred_ex (b8h b)) (pred_ex (b8l b)) - | false ⇒ mk_byte8 (b8h b) (pred_ex (b8l b)) ]. - -(* operatore successore *) -ndefinition succ_b8 ≝ -λb:byte8.match eq_ex (b8l b) xF with - [ true ⇒ mk_byte8 (succ_ex (b8h b)) (succ_ex (b8l b)) - | false ⇒ mk_byte8 (b8h b) (succ_ex (b8l b)) ]. - -(* operatore neg/complemento a 2 *) -ndefinition compl_b8 ≝ -λb:byte8.match MSB_b8 b with - [ true ⇒ succ_b8 (not_b8 b) - | false ⇒ not_b8 (pred_b8 b) ]. - -(* operatore moltiplicazione senza segno: e*e=[0x00,0xE1] *) -ndefinition mul_ex ≝ -λe1,e2:exadecim.match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x0〉 | x2 ⇒ 〈x0,x0〉 | x3 ⇒ 〈x0,x0〉 - | x4 ⇒ 〈x0,x0〉 | x5 ⇒ 〈x0,x0〉 | x6 ⇒ 〈x0,x0〉 | x7 ⇒ 〈x0,x0〉 - | x8 ⇒ 〈x0,x0〉 | x9 ⇒ 〈x0,x0〉 | xA ⇒ 〈x0,x0〉 | xB ⇒ 〈x0,x0〉 - | xC ⇒ 〈x0,x0〉 | xD ⇒ 〈x0,x0〉 | xE ⇒ 〈x0,x0〉 | xF ⇒ 〈x0,x0〉 ] - | x1 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x1〉 | x2 ⇒ 〈x0,x2〉 | x3 ⇒ 〈x0,x3〉 - | x4 ⇒ 〈x0,x4〉 | x5 ⇒ 〈x0,x5〉 | x6 ⇒ 〈x0,x6〉 | x7 ⇒ 〈x0,x7〉 - | x8 ⇒ 〈x0,x8〉 | x9 ⇒ 〈x0,x9〉 | xA ⇒ 〈x0,xA〉 | xB ⇒ 〈x0,xB〉 - | xC ⇒ 〈x0,xC〉 | xD ⇒ 〈x0,xD〉 | xE ⇒ 〈x0,xE〉 | xF ⇒ 〈x0,xF〉 ] - | x2 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x2〉 | x2 ⇒ 〈x0,x4〉 | x3 ⇒ 〈x0,x6〉 - | x4 ⇒ 〈x0,x8〉 | x5 ⇒ 〈x0,xA〉 | x6 ⇒ 〈x0,xC〉 | x7 ⇒ 〈x0,xE〉 - | x8 ⇒ 〈x1,x0〉 | x9 ⇒ 〈x1,x2〉 | xA ⇒ 〈x1,x4〉 | xB ⇒ 〈x1,x6〉 - | xC ⇒ 〈x1,x8〉 | xD ⇒ 〈x1,xA〉 | xE ⇒ 〈x1,xC〉 | xF ⇒ 〈x1,xE〉 ] - | x3 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x3〉 | x2 ⇒ 〈x0,x6〉 | x3 ⇒ 〈x0,x9〉 - | x4 ⇒ 〈x0,xC〉 | x5 ⇒ 〈x0,xF〉 | x6 ⇒ 〈x1,x2〉 | x7 ⇒ 〈x1,x5〉 - | x8 ⇒ 〈x1,x8〉 | x9 ⇒ 〈x1,xB〉 | xA ⇒ 〈x1,xE〉 | xB ⇒ 〈x2,x1〉 - | xC ⇒ 〈x2,x4〉 | xD ⇒ 〈x2,x7〉 | xE ⇒ 〈x2,xA〉 | xF ⇒ 〈x2,xD〉 ] - | x4 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x4〉 | x2 ⇒ 〈x0,x8〉 | x3 ⇒ 〈x0,xC〉 - | x4 ⇒ 〈x1,x0〉 | x5 ⇒ 〈x1,x4〉 | x6 ⇒ 〈x1,x8〉 | x7 ⇒ 〈x1,xC〉 - | x8 ⇒ 〈x2,x0〉 | x9 ⇒ 〈x2,x4〉 | xA ⇒ 〈x2,x8〉 | xB ⇒ 〈x2,xC〉 - | xC ⇒ 〈x3,x0〉 | xD ⇒ 〈x3,x4〉 | xE ⇒ 〈x3,x8〉 | xF ⇒ 〈x3,xC〉 ] - | x5 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x5〉 | x2 ⇒ 〈x0,xA〉 | x3 ⇒ 〈x0,xF〉 - | x4 ⇒ 〈x1,x4〉 | x5 ⇒ 〈x1,x9〉 | x6 ⇒ 〈x1,xE〉 | x7 ⇒ 〈x2,x3〉 - | x8 ⇒ 〈x2,x8〉 | x9 ⇒ 〈x2,xD〉 | xA ⇒ 〈x3,x2〉 | xB ⇒ 〈x3,x7〉 - | xC ⇒ 〈x3,xC〉 | xD ⇒ 〈x4,x1〉 | xE ⇒ 〈x4,x6〉 | xF ⇒ 〈x4,xB〉 ] - | x6 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x6〉 | x2 ⇒ 〈x0,xC〉 | x3 ⇒ 〈x1,x2〉 - | x4 ⇒ 〈x1,x8〉 | x5 ⇒ 〈x1,xE〉 | x6 ⇒ 〈x2,x4〉 | x7 ⇒ 〈x2,xA〉 - | x8 ⇒ 〈x3,x0〉 | x9 ⇒ 〈x3,x6〉 | xA ⇒ 〈x3,xC〉 | xB ⇒ 〈x4,x2〉 - | xC ⇒ 〈x4,x8〉 | xD ⇒ 〈x4,xE〉 | xE ⇒ 〈x5,x4〉 | xF ⇒ 〈x5,xA〉 ] - | x7 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x7〉 | x2 ⇒ 〈x0,xE〉 | x3 ⇒ 〈x1,x5〉 - | x4 ⇒ 〈x1,xC〉 | x5 ⇒ 〈x2,x3〉 | x6 ⇒ 〈x2,xA〉 | x7 ⇒ 〈x3,x1〉 - | x8 ⇒ 〈x3,x8〉 | x9 ⇒ 〈x3,xF〉 | xA ⇒ 〈x4,x6〉 | xB ⇒ 〈x4,xD〉 - | xC ⇒ 〈x5,x4〉 | xD ⇒ 〈x5,xB〉 | xE ⇒ 〈x6,x2〉 | xF ⇒ 〈x6,x9〉 ] - | x8 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x8〉 | x2 ⇒ 〈x1,x0〉 | x3 ⇒ 〈x1,x8〉 - | x4 ⇒ 〈x2,x0〉 | x5 ⇒ 〈x2,x8〉 | x6 ⇒ 〈x3,x0〉 | x7 ⇒ 〈x3,x8〉 - | x8 ⇒ 〈x4,x0〉 | x9 ⇒ 〈x4,x8〉 | xA ⇒ 〈x5,x0〉 | xB ⇒ 〈x5,x8〉 - | xC ⇒ 〈x6,x0〉 | xD ⇒ 〈x6,x8〉 | xE ⇒ 〈x7,x0〉 | xF ⇒ 〈x7,x8〉 ] - | x9 ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,x9〉 | x2 ⇒ 〈x1,x2〉 | x3 ⇒ 〈x1,xB〉 - | x4 ⇒ 〈x2,x4〉 | x5 ⇒ 〈x2,xD〉 | x6 ⇒ 〈x3,x6〉 | x7 ⇒ 〈x3,xF〉 - | x8 ⇒ 〈x4,x8〉 | x9 ⇒ 〈x5,x1〉 | xA ⇒ 〈x5,xA〉 | xB ⇒ 〈x6,x3〉 - | xC ⇒ 〈x6,xC〉 | xD ⇒ 〈x7,x5〉 | xE ⇒ 〈x7,xE〉 | xF ⇒ 〈x8,x7〉 ] - | xA ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xA〉 | x2 ⇒ 〈x1,x4〉 | x3 ⇒ 〈x1,xE〉 - | x4 ⇒ 〈x2,x8〉 | x5 ⇒ 〈x3,x2〉 | x6 ⇒ 〈x3,xC〉 | x7 ⇒ 〈x4,x6〉 - | x8 ⇒ 〈x5,x0〉 | x9 ⇒ 〈x5,xA〉 | xA ⇒ 〈x6,x4〉 | xB ⇒ 〈x6,xE〉 - | xC ⇒ 〈x7,x8〉 | xD ⇒ 〈x8,x2〉 | xE ⇒ 〈x8,xC〉 | xF ⇒ 〈x9,x6〉 ] - | xB ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xB〉 | x2 ⇒ 〈x1,x6〉 | x3 ⇒ 〈x2,x1〉 - | x4 ⇒ 〈x2,xC〉 | x5 ⇒ 〈x3,x7〉 | x6 ⇒ 〈x4,x2〉 | x7 ⇒ 〈x4,xD〉 - | x8 ⇒ 〈x5,x8〉 | x9 ⇒ 〈x6,x3〉 | xA ⇒ 〈x6,xE〉 | xB ⇒ 〈x7,x9〉 - | xC ⇒ 〈x8,x4〉 | xD ⇒ 〈x8,xF〉 | xE ⇒ 〈x9,xA〉 | xF ⇒ 〈xA,x5〉 ] - | xC ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xC〉 | x2 ⇒ 〈x1,x8〉 | x3 ⇒ 〈x2,x4〉 - | x4 ⇒ 〈x3,x0〉 | x5 ⇒ 〈x3,xC〉 | x6 ⇒ 〈x4,x8〉 | x7 ⇒ 〈x5,x4〉 - | x8 ⇒ 〈x6,x0〉 | x9 ⇒ 〈x6,xC〉 | xA ⇒ 〈x7,x8〉 | xB ⇒ 〈x8,x4〉 - | xC ⇒ 〈x9,x0〉 | xD ⇒ 〈x9,xC〉 | xE ⇒ 〈xA,x8〉 | xF ⇒ 〈xB,x4〉 ] - | xD ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xD〉 | x2 ⇒ 〈x1,xA〉 | x3 ⇒ 〈x2,x7〉 - | x4 ⇒ 〈x3,x4〉 | x5 ⇒ 〈x4,x1〉 | x6 ⇒ 〈x4,xE〉 | x7 ⇒ 〈x5,xB〉 - | x8 ⇒ 〈x6,x8〉 | x9 ⇒ 〈x7,x5〉 | xA ⇒ 〈x8,x2〉 | xB ⇒ 〈x8,xF〉 - | xC ⇒ 〈x9,xC〉 | xD ⇒ 〈xA,x9〉 | xE ⇒ 〈xB,x6〉 | xF ⇒ 〈xC,x3〉 ] - | xE ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xE〉 | x2 ⇒ 〈x1,xC〉 | x3 ⇒ 〈x2,xA〉 - | x4 ⇒ 〈x3,x8〉 | x5 ⇒ 〈x4,x6〉 | x6 ⇒ 〈x5,x4〉 | x7 ⇒ 〈x6,x2〉 - | x8 ⇒ 〈x7,x0〉 | x9 ⇒ 〈x7,xE〉 | xA ⇒ 〈x8,xC〉 | xB ⇒ 〈x9,xA〉 - | xC ⇒ 〈xA,x8〉 | xD ⇒ 〈xB,x6〉 | xE ⇒ 〈xC,x4〉 | xF ⇒ 〈xD,x2〉 ] - | xF ⇒ match e2 with - [ x0 ⇒ 〈x0,x0〉 | x1 ⇒ 〈x0,xF〉 | x2 ⇒ 〈x1,xE〉 | x3 ⇒ 〈x2,xD〉 - | x4 ⇒ 〈x3,xC〉 | x5 ⇒ 〈x4,xB〉 | x6 ⇒ 〈x5,xA〉 | x7 ⇒ 〈x6,x9〉 - | x8 ⇒ 〈x7,x8〉 | x9 ⇒ 〈x8,x7〉 | xA ⇒ 〈x9,x6〉 | xB ⇒ 〈xA,x5〉 - | xC ⇒ 〈xB,x4〉 | xD ⇒ 〈xC,x3〉 | xE ⇒ 〈xD,x2〉 | xF ⇒ 〈xE,x1〉 ] - ]. - -(* correzione per somma su BCD *) -(* input: halfcarry,carry,X(BCD+BCD) *) -(* output: X',carry' *) -ndefinition daa_b8 ≝ -λh,c:bool.λX:byte8. - match lt_b8 X 〈x9,xA〉 with - (* [X:0x00-0x99] *) - (* c' = c *) - (* X' = [(b16l X):0x0-0x9] X + [h=1 ? 0x06 : 0x00] + [c=1 ? 0x60 : 0x00] - [(b16l X):0xA-0xF] X + 0x06 + [c=1 ? 0x60 : 0x00] *) - [ true ⇒ - let X' ≝ match (lt_ex (b8l X) xA) ⊗ (⊖h) with - [ true ⇒ X - | false ⇒ plus_b8_d_d X 〈x0,x6〉 ] in - let X'' ≝ match c with - [ true ⇒ plus_b8_d_d X' 〈x6,x0〉 - | false ⇒ X' ] in - pair … X'' c - (* [X:0x9A-0xFF] *) - (* c' = 1 *) - (* X' = [X:0x9A-0xFF] - [(b16l X):0x0-0x9] X + [h=1 ? 0x06 : 0x00] + 0x60 - [(b16l X):0xA-0xF] X + 0x6 + 0x60 *) - | false ⇒ - let X' ≝ match (lt_ex (b8l X) xA) ⊗ (⊖h) with - [ true ⇒ X - | false ⇒ plus_b8_d_d X 〈x0,x6〉 ] in - let X'' ≝ plus_b8_d_d X' 〈x6,x0〉 in - pair … X'' true - ]. - -(* operatore x in [inf,sup] o in sup],[inf *) -ndefinition inrange_b8 ≝ -λx,inf,sup:byte8. - match le_b8 inf sup with - [ true ⇒ and_bool | false ⇒ or_bool ] - (le_b8 inf x) (le_b8 x sup). - -(* iteratore sui byte *) -ndefinition forall_b8 ≝ - λP. - forall_ex (λbh. - forall_ex (λbl. - P (mk_byte8 bh bl))). - -(* byte ricorsivi *) -ninductive rec_byte8 : byte8 → Type ≝ - b8_O : rec_byte8 〈x0,x0〉 -| b8_S : ∀n.rec_byte8 n → rec_byte8 (succ_b8 n). - -(* byte → byte ricorsivi *) -ndefinition b8_to_recb8_aux1 : Πn.rec_byte8 〈n,x0〉 → rec_byte8 〈succ_ex n,x0〉 ≝ -λn.λrecb:rec_byte8 〈n,x0〉. - b8_S 〈n,xF〉 (b8_S 〈n,xE〉 (b8_S 〈n,xD〉 (b8_S 〈n,xC〉 ( - b8_S 〈n,xB〉 (b8_S 〈n,xA〉 (b8_S 〈n,x9〉 (b8_S 〈n,x8〉 ( - b8_S 〈n,x7〉 (b8_S 〈n,x6〉 (b8_S 〈n,x5〉 (b8_S 〈n,x4〉 ( - b8_S 〈n,x3〉 (b8_S 〈n,x2〉 (b8_S 〈n,x1〉 (b8_S 〈n,x0〉 recb))))))))))))))). - -(* ... cifra esadecimale superiore *) -nlet rec b8_to_recb8_aux2 (n:exadecim) (r:rec_exadecim n) on r ≝ - match r return λx.λy:rec_exadecim x.rec_byte8 〈x,x0〉 with - [ ex_O ⇒ b8_O - | ex_S t n' ⇒ b8_to_recb8_aux1 ? (b8_to_recb8_aux2 t n') - ]. - -(* ... cifra esadecimale inferiore *) -ndefinition b8_to_recb8_aux3 : Πn1,n2.rec_byte8 〈n1,x0〉 → rec_byte8 〈n1,n2〉 ≝ -λn1,n2.λrecb:rec_byte8 〈n1,x0〉. - match n2 return λx.rec_byte8 〈n1,x〉 with - [ x0 ⇒ recb - | x1 ⇒ b8_S 〈n1,x0〉 recb - | x2 ⇒ b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb) - | x3 ⇒ b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb)) - | x4 ⇒ b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))) - | x5 ⇒ b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 ( - b8_S 〈n1,x0〉 recb)))) - | x6 ⇒ b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 ( - b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))))) - | x7 ⇒ b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 ( - b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb)))))) - | x8 ⇒ b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 ( - b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))))))) - | x9 ⇒ b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 ( - b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 ( - b8_S 〈n1,x0〉 recb)))))))) - | xA ⇒ b8_S 〈n1,x9〉 (b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 ( - b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 ( - b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))))))))) - | xB ⇒ b8_S 〈n1,xA〉 (b8_S 〈n1,x9〉 (b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 ( - b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 ( - b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb)))))))))) - | xC ⇒ b8_S 〈n1,xB〉 (b8_S 〈n1,xA〉 (b8_S 〈n1,x9〉 (b8_S 〈n1,x8〉 ( - b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 ( - b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))))))))))) - | xD ⇒ b8_S 〈n1,xC〉 (b8_S 〈n1,xB〉 (b8_S 〈n1,xA〉 (b8_S 〈n1,x9〉 ( - b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 ( - b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 ( - b8_S 〈n1,x0〉 recb)))))))))))) - | xE ⇒ b8_S 〈n1,xD〉 (b8_S 〈n1,xC〉 (b8_S 〈n1,xB〉 (b8_S 〈n1,xA〉 ( - b8_S 〈n1,x9〉 (b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 (b8_S 〈n1,x6〉 ( - b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 (b8_S 〈n1,x2〉 ( - b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb))))))))))))) - | xF ⇒ b8_S 〈n1,xE〉 (b8_S 〈n1,xD〉 (b8_S 〈n1,xC〉 (b8_S 〈n1,xB〉 ( - b8_S 〈n1,xA〉 (b8_S 〈n1,x9〉 (b8_S 〈n1,x8〉 (b8_S 〈n1,x7〉 ( - b8_S 〈n1,x6〉 (b8_S 〈n1,x5〉 (b8_S 〈n1,x4〉 (b8_S 〈n1,x3〉 ( - b8_S 〈n1,x2〉 (b8_S 〈n1,x1〉 (b8_S 〈n1,x0〉 recb)))))))))))))) - ]. - -(* -nlemma b8_to_recb8 : Πb.rec_byte8 b. - #b; nletin K ≝ (b8_to_recb8_aux3 - (b8h b) (b8l b) (b8_to_recb8_aux2 (b8h b) (ex_to_recex (b8h b)))); - ncases b in K; #e1; #e2; #K; napply K; -nqed. -*) - -ndefinition b8_to_recb8 : Πb.rec_byte8 b ≝ -λb.match b with [ mk_byte8 h l ⇒ b8_to_recb8_aux3 h l (b8_to_recb8_aux2 h (ex_to_recex h)) ]. - -(* ottali → esadecimali *) -ndefinition b8_of_bit ≝ -λn.match n with - [ t00 ⇒ 〈x0,x0〉 | t01 ⇒ 〈x0,x1〉 | t02 ⇒ 〈x0,x2〉 | t03 ⇒ 〈x0,x3〉 - | t04 ⇒ 〈x0,x4〉 | t05 ⇒ 〈x0,x5〉 | t06 ⇒ 〈x0,x6〉 | t07 ⇒ 〈x0,x7〉 - | t08 ⇒ 〈x0,x8〉 | t09 ⇒ 〈x0,x9〉 | t0A ⇒ 〈x0,xA〉 | t0B ⇒ 〈x0,xB〉 - | t0C ⇒ 〈x0,xC〉 | t0D ⇒ 〈x0,xD〉 | t0E ⇒ 〈x0,xE〉 | t0F ⇒ 〈x0,xF〉 - | t10 ⇒ 〈x1,x0〉 | t11 ⇒ 〈x1,x1〉 | t12 ⇒ 〈x1,x2〉 | t13 ⇒ 〈x1,x3〉 - | t14 ⇒ 〈x1,x4〉 | t15 ⇒ 〈x1,x5〉 | t16 ⇒ 〈x1,x6〉 | t17 ⇒ 〈x1,x7〉 - | t18 ⇒ 〈x1,x8〉 | t19 ⇒ 〈x1,x9〉 | t1A ⇒ 〈x1,xA〉 | t1B ⇒ 〈x1,xB〉 - | t1C ⇒ 〈x1,xC〉 | t1D ⇒ 〈x1,xD〉 | t1E ⇒ 〈x1,xE〉 | t1F ⇒ 〈x1,xF〉 - ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/byte8_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/byte8_lemmas.ma deleted file mode 100755 index 10a100965..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/byte8_lemmas.ma +++ /dev/null @@ -1,338 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/byte8.ma". -include "num/exadecim_lemmas.ma". - -(* **** *) -(* BYTE *) -(* **** *) - -nlemma byte8_destruct_1 : -∀x1,x2,y1,y2. - mk_byte8 x1 y1 = mk_byte8 x2 y2 → x1 = x2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_byte8 x2 y2 with [ mk_byte8 a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma byte8_destruct_2 : -∀x1,x2,y1,y2. - mk_byte8 x1 y1 = mk_byte8 x2 y2 → y1 = y2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_byte8 x2 y2 with [ mk_byte8 _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqb8 : symmetricT byte8 bool eq_b8. - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange with (((eq_ex e3 e1)⊗(eq_ex e4 e2)) = ((eq_ex e1 e3)⊗(eq_ex e2 e4))); - nrewrite > (symmetric_eqex e1 e3); - nrewrite > (symmetric_eqex e2 e4); - napply refl_eq. -nqed. - -nlemma symmetric_andb8 : symmetricT byte8 byte8 and_b8. - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange with ((mk_byte8 (and_ex e3 e1) (and_ex e4 e2)) = (mk_byte8 (and_ex e1 e3) (and_ex e2 e4))); - nrewrite > (symmetric_andex e1 e3); - nrewrite > (symmetric_andex e2 e4); - napply refl_eq. -nqed. - -nlemma associative_andb8 : ∀b1,b2,b3.(and_b8 (and_b8 b1 b2) b3) = (and_b8 b1 (and_b8 b2 b3)). - #b1; #b2; #b3; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nelim b3; - #e5; #e6; - nchange with (mk_byte8 (and_ex (and_ex e1 e3) e5) (and_ex (and_ex e2 e4) e6) = - mk_byte8 (and_ex e1 (and_ex e3 e5)) (and_ex e2 (and_ex e4 e6))); - nrewrite < (associative_andex e1 e3 e5); - nrewrite < (associative_andex e2 e4 e6); - napply refl_eq. -nqed. - -nlemma symmetric_orb8 : symmetricT byte8 byte8 or_b8. - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange with ((mk_byte8 (or_ex e3 e1) (or_ex e4 e2)) = (mk_byte8 (or_ex e1 e3) (or_ex e2 e4))); - nrewrite > (symmetric_orex e1 e3); - nrewrite > (symmetric_orex e2 e4); - napply refl_eq. -nqed. - -nlemma associative_orb8 : ∀b1,b2,b3.(or_b8 (or_b8 b1 b2) b3) = (or_b8 b1 (or_b8 b2 b3)). - #b1; #b2; #b3; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nelim b3; - #e5; #e6; - nchange with (mk_byte8 (or_ex (or_ex e1 e3) e5) (or_ex (or_ex e2 e4) e6) = - mk_byte8 (or_ex e1 (or_ex e3 e5)) (or_ex e2 (or_ex e4 e6))); - nrewrite < (associative_orex e1 e3 e5); - nrewrite < (associative_orex e2 e4 e6); - napply refl_eq. -nqed. - -nlemma symmetric_xorb8 : symmetricT byte8 byte8 xor_b8. - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange with ((mk_byte8 (xor_ex e3 e1) (xor_ex e4 e2)) = (mk_byte8 (xor_ex e1 e3) (xor_ex e2 e4))); - nrewrite > (symmetric_xorex e1 e3); - nrewrite > (symmetric_xorex e2 e4); - napply refl_eq. -nqed. - -nlemma associative_xorb8 : ∀b1,b2,b3.(xor_b8 (xor_b8 b1 b2) b3) = (xor_b8 b1 (xor_b8 b2 b3)). - #b1; #b2; #b3; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nelim b3; - #e5; #e6; - nchange with (mk_byte8 (xor_ex (xor_ex e1 e3) e5) (xor_ex (xor_ex e2 e4) e6) = - mk_byte8 (xor_ex e1 (xor_ex e3 e5)) (xor_ex e2 (xor_ex e4 e6))); - nrewrite < (associative_xorex e1 e3 e5); - nrewrite < (associative_xorex e2 e4 e6); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_dc_dc : ∀b1,b2,c.plus_b8_dc_dc b1 b2 c = plus_b8_dc_dc b2 b1 c. - #b1; #b2; #c; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - match plus_ex_dc_dc e2 e4 c with [ pair l c ⇒ match plus_ex_dc_dc e1 e3 c with [ pair h c' ⇒ pair … 〈h,l〉 c' ]] = - match plus_ex_dc_dc e4 e2 c with [ pair l c ⇒ match plus_ex_dc_dc e3 e1 c with [ pair h c' ⇒ pair … 〈h,l〉 c' ]]); - nrewrite > (symmetric_plusex_dc_dc e4 e2 c); - ncases (plus_ex_dc_dc e2 e4 c); - #e5; #c1; - nchange with ( - match plus_ex_dc_dc e1 e3 c1 with [ pair h c' ⇒ pair … 〈h,e5〉 c' ] = - match plus_ex_dc_dc e3 e1 c1 with [ pair h c' ⇒ pair … 〈h,e5〉 c' ]); - nrewrite > (symmetric_plusex_dc_dc e1 e3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_dc_d : ∀b1,b2,c.plus_b8_dc_d b1 b2 c = plus_b8_dc_d b2 b1 c. - #b1; #b2; #c; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - match plus_ex_dc_dc e2 e4 c with [ pair l c ⇒ 〈plus_ex_dc_d e1 e3 c,l〉 ] = - match plus_ex_dc_dc e4 e2 c with [ pair l c ⇒ 〈plus_ex_dc_d e3 e1 c,l〉 ]); - nrewrite > (symmetric_plusex_dc_dc e4 e2 c); - ncases (plus_ex_dc_dc e2 e4 c); - #e5; #c1; - nchange with (〈plus_ex_dc_d e1 e3 c1,e5〉 = 〈plus_ex_dc_d e3 e1 c1,e5〉); - nrewrite > (symmetric_plusex_dc_d e1 e3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_dc_c : ∀b1,b2,c.plus_b8_dc_c b1 b2 c = plus_b8_dc_c b2 b1 c. - #b1; #b2; #c; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - plus_ex_dc_c e1 e3 (plus_ex_dc_c e2 e4 c) = - plus_ex_dc_c e3 e1 (plus_ex_dc_c e4 e2 c)); - nrewrite > (symmetric_plusex_dc_c e4 e2 c); - nrewrite > (symmetric_plusex_dc_c e3 e1 (plus_ex_dc_c e2 e4 c)); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_d_dc : ∀b1,b2.plus_b8_d_dc b1 b2 = plus_b8_d_dc b2 b1. - #b1; #b2; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - match plus_ex_d_dc e2 e4 with [ pair l c ⇒ match plus_ex_dc_dc e1 e3 c with [ pair h c' ⇒ pair … 〈h,l〉 c' ]] = - match plus_ex_d_dc e4 e2 with [ pair l c ⇒ match plus_ex_dc_dc e3 e1 c with [ pair h c' ⇒ pair … 〈h,l〉 c' ]]); - nrewrite > (symmetric_plusex_d_dc e4 e2); - ncases (plus_ex_d_dc e2 e4); - #e5; #c; - nchange with ( - match plus_ex_dc_dc e1 e3 c with [ pair h c' ⇒ pair … 〈h,e5〉 c' ] = - match plus_ex_dc_dc e3 e1 c with [ pair h c' ⇒ pair … 〈h,e5〉 c' ]); - nrewrite > (symmetric_plusex_dc_dc e1 e3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_d_d : ∀b1,b2.plus_b8_d_d b1 b2 = plus_b8_d_d b2 b1. - #b1; #b2; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - match plus_ex_d_dc e2 e4 with [ pair l c ⇒ 〈plus_ex_dc_d e1 e3 c,l〉 ] = - match plus_ex_d_dc e4 e2 with [ pair l c ⇒ 〈plus_ex_dc_d e3 e1 c,l〉 ]); - nrewrite > (symmetric_plusex_d_dc e4 e2); - ncases (plus_ex_d_dc e2 e4); - #e5; #c; - nchange with (〈plus_ex_dc_d e1 e3 c,e5〉 = 〈plus_ex_dc_d e3 e1 c,e5〉); - nrewrite > (symmetric_plusex_dc_d e1 e3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusb8_d_c : ∀b1,b2.plus_b8_d_c b1 b2 = plus_b8_d_c b2 b1. - #b1; #b2; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with ( - plus_ex_dc_c e1 e3 (plus_ex_d_c e2 e4) = - plus_ex_dc_c e3 e1 (plus_ex_d_c e4 e2)); - nrewrite > (symmetric_plusex_d_c e4 e2); - nrewrite > (symmetric_plusex_dc_c e3 e1 (plus_ex_d_c e2 e4)); - napply refl_eq. -nqed. - -nlemma symmetric_mulex : symmetricT exadecim byte8 mul_ex. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma eqb8_to_eq : ∀b1,b2:byte8.(eq_b8 b1 b2 = true) → (b1 = b2). - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange in ⊢ (% → ?) with (((eq_ex e3 e1)⊗(eq_ex e4 e2)) = true); - #H; - nrewrite < (eqex_to_eq … (andb_true_true_l … H)); - nrewrite < (eqex_to_eq … (andb_true_true_r … H)); - napply refl_eq. -nqed. - -nlemma eq_to_eqb8 : ∀b1,b2.b1 = b2 → eq_b8 b1 b2 = true. - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - #H; - nrewrite < (byte8_destruct_1 … H); - nrewrite < (byte8_destruct_2 … H); - nchange with (((eq_ex e3 e3)⊗(eq_ex e4 e4)) = true); - nrewrite > (eq_to_eqex e3 e3 (refl_eq …)); - nrewrite > (eq_to_eqex e4 e4 (refl_eq …)); - nnormalize; - napply refl_eq. -nqed. - -nlemma decidable_b8_aux1 : ∀e1,e2,e3,e4.e1 ≠ e3 → 〈e1,e2〉 ≠ 〈e3,e4〉. - #e1; #e2; #e3; #e4; - nnormalize; #H; #H1; - napply (H (byte8_destruct_1 … H1)). -nqed. - -nlemma decidable_b8_aux2 : ∀e1,e2,e3,e4.e2 ≠ e4 → 〈e1,e2〉 ≠ 〈e3,e4〉. - #e1; #e2; #e3; #e4; - nnormalize; #H; #H1; - napply (H (byte8_destruct_2 … H1)). -nqed. - -nlemma decidable_b8 : ∀x,y:byte8.decidable (x = y). - #x; nelim x; #e1; #e2; - #y; nelim y; #e3; #e4; - nnormalize; - napply (or2_elim (e1 = e3) (e1 ≠ e3) ? (decidable_ex e1 e3) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_b8_aux1 e1 e2 e3 e4 H)) - ##| ##1: #H; napply (or2_elim (e2 = e4) (e2 ≠ e4) ? (decidable_ex e2 e4) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_b8_aux2 e1 e2 e3 e4 H1)) - ##| ##1: #H1; nrewrite > H; nrewrite > H1; - napply (or2_intro1 … (refl_eq ? 〈e3,e4〉)) - ##] - ##] -nqed. - -nlemma neqb8_to_neq : ∀b1,b2:byte8.(eq_b8 b1 b2 = false) → (b1 ≠ b2). - #b1; #b2; - nelim b1; - nelim b2; - #e1; #e2; #e3; #e4; - nchange with ((((eq_ex e3 e1) ⊗ (eq_ex e4 e2)) = false) → ?); - #H; - napply (or2_elim ((eq_ex e3 e1) = false) ((eq_ex e4 e2) = false) ? (andb_false2 … H) …); - ##[ ##1: #H1; napply (decidable_b8_aux1 … (neqex_to_neq … H1)) - ##| ##2: #H1; napply (decidable_b8_aux2 … (neqex_to_neq … H1)) - ##] -nqed. - -nlemma byte8_destruct : ∀e1,e2,e3,e4.〈e1,e2〉 ≠ 〈e3,e4〉 → e1 ≠ e3 ∨ e2 ≠ e4. - #e1; #e2; #e3; #e4; - nnormalize; #H; - napply (or2_elim (e1 = e3) (e1 ≠ e3) ? (decidable_ex e1 e3) …); - ##[ ##2: #H1; napply (or2_intro1 … H1) - ##| ##1: #H1; napply (or2_elim (e2 = e4) (e2 ≠ e4) ? (decidable_ex e2 e4) …); - ##[ ##2: #H2; napply (or2_intro2 … H2) - ##| ##1: #H2; nrewrite > H1 in H:(%); - nrewrite > H2; - #H; nelim (H (refl_eq …)) - ##] - ##] -nqed. - -nlemma neq_to_neqb8 : ∀b1,b2.b1 ≠ b2 → eq_b8 b1 b2 = false. - #b1; #b2; - nelim b1; #e1; #e2; - nelim b2; #e3; #e4; - #H; nchange with (((eq_ex e1 e3) ⊗ (eq_ex e2 e4)) = false); - napply (or2_elim (e1 ≠ e3) (e2 ≠ e4) ? (byte8_destruct … H) …); - ##[ ##1: #H1; nrewrite > (neq_to_neqex … H1); nnormalize; napply refl_eq - ##| ##2: #H1; nrewrite > (neq_to_neqex … H1); - nrewrite > (symmetric_andbool (eq_ex e1 e3) false); - nnormalize; napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/exadecim.ma b/helm/software/matita/contribs/ng_assembly/num/exadecim.ma deleted file mode 100755 index e75c80bd6..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/exadecim.ma +++ /dev/null @@ -1,1427 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". -include "num/quatern.ma". -include "num/oct.ma". -include "common/prod.ma". -include "common/nat.ma". - -(* *********** *) -(* ESADECIMALI *) -(* *********** *) - -ninductive exadecim : Type ≝ - x0: exadecim -| x1: exadecim -| x2: exadecim -| x3: exadecim -| x4: exadecim -| x5: exadecim -| x6: exadecim -| x7: exadecim -| x8: exadecim -| x9: exadecim -| xA: exadecim -| xB: exadecim -| xC: exadecim -| xD: exadecim -| xE: exadecim -| xF: exadecim. - -(* operatore = *) -ndefinition eq_ex ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with [ x0 ⇒ true | _ ⇒ false ] - | x1 ⇒ match e2 with [ x1 ⇒ true | _ ⇒ false ] - | x2 ⇒ match e2 with [ x2 ⇒ true | _ ⇒ false ] - | x3 ⇒ match e2 with [ x3 ⇒ true | _ ⇒ false ] - | x4 ⇒ match e2 with [ x4 ⇒ true | _ ⇒ false ] - | x5 ⇒ match e2 with [ x5 ⇒ true | _ ⇒ false ] - | x6 ⇒ match e2 with [ x6 ⇒ true | _ ⇒ false ] - | x7 ⇒ match e2 with [ x7 ⇒ true | _ ⇒ false ] - | x8 ⇒ match e2 with [ x8 ⇒ true | _ ⇒ false ] - | x9 ⇒ match e2 with [ x9 ⇒ true | _ ⇒ false ] - | xA ⇒ match e2 with [ xA ⇒ true | _ ⇒ false ] - | xB ⇒ match e2 with [ xB ⇒ true | _ ⇒ false ] - | xC ⇒ match e2 with [ xC ⇒ true | _ ⇒ false ] - | xD ⇒ match e2 with [ xD ⇒ true | _ ⇒ false ] - | xE ⇒ match e2 with [ xE ⇒ true | _ ⇒ false ] - | xF ⇒ match e2 with [ xF ⇒ true | _ ⇒ false ] - ]. - -(* operatore < *) -ndefinition lt_ex ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x1 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x2 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x3 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x4 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x5 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x6 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x7 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x8 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x9 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xA ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xB ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xC ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xD ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ true ] - | xE ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ] - | xF ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - ]. - -(* operatore ≤ *) -ndefinition le_ex ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x1 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x2 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x3 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x4 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x5 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x6 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x7 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x8 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x9 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xA ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xB ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xC ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xD ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xE ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ true ] - | xF ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ] - ]. - -(* operatore > *) -ndefinition gt_ex ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x1 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x2 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x3 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x4 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x5 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x6 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x7 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x8 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x9 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xA ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xB ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xC ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xD ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xE ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ false | xF ⇒ false ] - | xF ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ false ] - ]. - -(* operatore ≥ *) -ndefinition ge_ex ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x1 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x2 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x3 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x4 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x5 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x6 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x7 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x8 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ false | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x9 ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ false | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xA ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ false - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xB ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xC ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | xD ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ false | xF ⇒ false ] - | xE ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ false ] - | xF ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true - | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - ]. - -(* operatore and *) -ndefinition and_ex ≝ -λe1,e2:exadecim.match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x0 | x3 ⇒ x0 - | x4 ⇒ x0 | x5 ⇒ x0 | x6 ⇒ x0 | x7 ⇒ x0 - | x8 ⇒ x0 | x9 ⇒ x0 | xA ⇒ x0 | xB ⇒ x0 - | xC ⇒ x0 | xD ⇒ x0 | xE ⇒ x0 | xF ⇒ x0 ] - | x1 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x0 | x3 ⇒ x1 - | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x0 | xB ⇒ x1 - | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x0 | xF ⇒ x1 ] - | x2 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x2 | x3 ⇒ x2 - | x4 ⇒ x0 | x5 ⇒ x0 | x6 ⇒ x2 | x7 ⇒ x2 - | x8 ⇒ x0 | x9 ⇒ x0 | xA ⇒ x2 | xB ⇒ x2 - | xC ⇒ x0 | xD ⇒ x0 | xE ⇒ x2 | xF ⇒ x2 ] - | x3 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 - | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x2 | xF ⇒ x3 ] - | x4 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x0 | x3 ⇒ x0 - | x4 ⇒ x4 | x5 ⇒ x4 | x6 ⇒ x4 | x7 ⇒ x4 - | x8 ⇒ x0 | x9 ⇒ x0 | xA ⇒ x0 | xB ⇒ x0 - | xC ⇒ x4 | xD ⇒ x4 | xE ⇒ x4 | xF ⇒ x4 ] - | x5 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x0 | x3 ⇒ x1 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x0 | xB ⇒ x1 - | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x4 | xF ⇒ x5 ] - | x6 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x2 | x3 ⇒ x2 - | x4 ⇒ x4 | x5 ⇒ x4 | x6 ⇒ x6 | x7 ⇒ x6 - | x8 ⇒ x0 | x9 ⇒ x0 | xA ⇒ x2 | xB ⇒ x2 - | xC ⇒ x4 | xD ⇒ x4 | xE ⇒ x6 | xF ⇒ x6 ] - | x7 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 - | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ] - | x8 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x0 | x3 ⇒ x0 - | x4 ⇒ x0 | x5 ⇒ x0 | x6 ⇒ x0 | x7 ⇒ x0 - | x8 ⇒ x8 | x9 ⇒ x8 | xA ⇒ x8 | xB ⇒ x8 - | xC ⇒ x8 | xD ⇒ x8 | xE ⇒ x8 | xF ⇒ x8 ] - | x9 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x0 | x3 ⇒ x1 - | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ x8 | xB ⇒ x9 - | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ x8 | xF ⇒ x9 ] - | xA ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x2 | x3 ⇒ x2 - | x4 ⇒ x0 | x5 ⇒ x0 | x6 ⇒ x2 | x7 ⇒ x2 - | x8 ⇒ x8 | x9 ⇒ x8 | xA ⇒ xA | xB ⇒ xA - | xC ⇒ x8 | xD ⇒ x8 | xE ⇒ xA | xF ⇒ xA ] - | xB ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB - | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ xA | xF ⇒ xB ] - | xC ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x0 | x3 ⇒ x0 - | x4 ⇒ x4 | x5 ⇒ x4 | x6 ⇒ x4 | x7 ⇒ x4 - | x8 ⇒ x8 | x9 ⇒ x8 | xA ⇒ x8 | xB ⇒ x8 - | xC ⇒ xC | xD ⇒ xC | xE ⇒ xC | xF ⇒ xC ] - | xD ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x0 | x3 ⇒ x1 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ x8 | xB ⇒ x9 - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xC | xF ⇒ xD ] - | xE ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x2 | x3 ⇒ x2 - | x4 ⇒ x4 | x5 ⇒ x4 | x6 ⇒ x6 | x7 ⇒ x6 - | x8 ⇒ x8 | x9 ⇒ x8 | xA ⇒ xA | xB ⇒ xA - | xC ⇒ xC | xD ⇒ xC | xE ⇒ xE | xF ⇒ xE ] - | xF ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - ]. - -(* operatore or *) -ndefinition or_ex ≝ -λe1,e2:exadecim.match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x1 ⇒ match e2 with - [ x0 ⇒ x1 | x1 ⇒ x1 | x2 ⇒ x3 | x3 ⇒ x3 - | x4 ⇒ x5 | x5 ⇒ x5 | x6 ⇒ x7 | x7 ⇒ x7 - | x8 ⇒ x9 | x9 ⇒ x9 | xA ⇒ xB | xB ⇒ xB - | xC ⇒ xD | xD ⇒ xD | xE ⇒ xF | xF ⇒ xF ] - | x2 ⇒ match e2 with - [ x0 ⇒ x2 | x1 ⇒ x3 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xE | xD ⇒ xF | xE ⇒ xE | xF ⇒ xF ] - | x3 ⇒ match e2 with - [ x0 ⇒ x3 | x1 ⇒ x3 | x2 ⇒ x3 | x3 ⇒ x3 - | x4 ⇒ x7 | x5 ⇒ x7 | x6 ⇒ x7 | x7 ⇒ x7 - | x8 ⇒ xB | x9 ⇒ xB | xA ⇒ xB | xB ⇒ xB - | xC ⇒ xF | xD ⇒ xF | xE ⇒ xF | xF ⇒ xF ] - | x4 ⇒ match e2 with - [ x0 ⇒ x4 | x1 ⇒ x5 | x2 ⇒ x6 | x3 ⇒ x7 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x5 ⇒ match e2 with - [ x0 ⇒ x5 | x1 ⇒ x5 | x2 ⇒ x7 | x3 ⇒ x7 - | x4 ⇒ x5 | x5 ⇒ x5 | x6 ⇒ x7 | x7 ⇒ x7 - | x8 ⇒ xD | x9 ⇒ xD | xA ⇒ xF | xB ⇒ xF - | xC ⇒ xD | xD ⇒ xD | xE ⇒ xF | xF ⇒ xF ] - | x6 ⇒ match e2 with - [ x0 ⇒ x6 | x1 ⇒ x7 | x2 ⇒ x6 | x3 ⇒ x7 - | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ xE | xB ⇒ xF - | xC ⇒ xE | xD ⇒ xF | xE ⇒ xE | xF ⇒ xF ] - | x7 ⇒ match e2 with - [ x0 ⇒ x7 | x1 ⇒ x7 | x2 ⇒ x7 | x3 ⇒ x7 - | x4 ⇒ x7 | x5 ⇒ x7 | x6 ⇒ x7 | x7 ⇒ x7 - | x8 ⇒ xF | x9 ⇒ xF | xA ⇒ xF | xB ⇒ xF - | xC ⇒ xF | xD ⇒ xF | xE ⇒ xF | xF ⇒ xF ] - | x8 ⇒ match e2 with - [ x0 ⇒ x8 | x1 ⇒ x9 | x2 ⇒ xA | x3 ⇒ xB - | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x9 ⇒ match e2 with - [ x0 ⇒ x9 | x1 ⇒ x9 | x2 ⇒ xB | x3 ⇒ xB - | x4 ⇒ xD | x5 ⇒ xD | x6 ⇒ xF | x7 ⇒ xF - | x8 ⇒ x9 | x9 ⇒ x9 | xA ⇒ xB | xB ⇒ xB - | xC ⇒ xD | xD ⇒ xD | xE ⇒ xF | xF ⇒ xF ] - | xA ⇒ match e2 with - [ x0 ⇒ xA | x1 ⇒ xB | x2 ⇒ xA | x3 ⇒ xB - | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xE | xD ⇒ xF | xE ⇒ xE | xF ⇒ xF ] - | xB ⇒ match e2 with - [ x0 ⇒ xB | x1 ⇒ xB | x2 ⇒ xB | x3 ⇒ xB - | x4 ⇒ xF | x5 ⇒ xF | x6 ⇒ xF | x7 ⇒ xF - | x8 ⇒ xB | x9 ⇒ xB | xA ⇒ xB | xB ⇒ xB - | xC ⇒ xF | xD ⇒ xF | xE ⇒ xF | xF ⇒ xF ] - | xC ⇒ match e2 with - [ x0 ⇒ xC | x1 ⇒ xD | x2 ⇒ xE | x3 ⇒ xF - | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | xD ⇒ match e2 with - [ x0 ⇒ xD | x1 ⇒ xD | x2 ⇒ xF | x3 ⇒ xF - | x4 ⇒ xD | x5 ⇒ xD | x6 ⇒ xF | x7 ⇒ xF - | x8 ⇒ xD | x9 ⇒ xD | xA ⇒ xF | xB ⇒ xF - | xC ⇒ xD | xD ⇒ xD | xE ⇒ xF | xF ⇒ xF ] - | xE ⇒ match e2 with - [ x0 ⇒ xE | x1 ⇒ xF | x2 ⇒ xE | x3 ⇒ xF - | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ xE | xB ⇒ xF - | xC ⇒ xE | xD ⇒ xF | xE ⇒ xE | xF ⇒ xF ] - | xF ⇒ match e2 with - [ x0 ⇒ xF | x1 ⇒ xF | x2 ⇒ xF | x3 ⇒ xF - | x4 ⇒ xF | x5 ⇒ xF | x6 ⇒ xF | x7 ⇒ xF - | x8 ⇒ xF | x9 ⇒ xF | xA ⇒ xF | xB ⇒ xF - | xC ⇒ xF | xD ⇒ xF | xE ⇒ xF | xF ⇒ xF ] - ]. - -(* operatore xor *) -ndefinition xor_ex ≝ -λe1,e2:exadecim.match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 - | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB - | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x1 ⇒ match e2 with - [ x0 ⇒ x1 | x1 ⇒ x0 | x2 ⇒ x3 | x3 ⇒ x2 - | x4 ⇒ x5 | x5 ⇒ x4 | x6 ⇒ x7 | x7 ⇒ x6 - | x8 ⇒ x9 | x9 ⇒ x8 | xA ⇒ xB | xB ⇒ xA - | xC ⇒ xD | xD ⇒ xC | xE ⇒ xF | xF ⇒ xE ] - | x2 ⇒ match e2 with - [ x0 ⇒ x2 | x1 ⇒ x3 | x2 ⇒ x0 | x3 ⇒ x1 - | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ x8 | xB ⇒ x9 - | xC ⇒ xE | xD ⇒ xF | xE ⇒ xC | xF ⇒ xD ] - | x3 ⇒ match e2 with - [ x0 ⇒ x3 | x1 ⇒ x2 | x2 ⇒ x1 | x3 ⇒ x0 - | x4 ⇒ x7 | x5 ⇒ x6 | x6 ⇒ x5 | x7 ⇒ x4 - | x8 ⇒ xB | x9 ⇒ xA | xA ⇒ x9 | xB ⇒ x8 - | xC ⇒ xF | xD ⇒ xE | xE ⇒ xD | xF ⇒ xC ] - | x4 ⇒ match e2 with - [ x0 ⇒ x4 | x1 ⇒ x5 | x2 ⇒ x6 | x3 ⇒ x7 - | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF - | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ xA | xF ⇒ xB ] - | x5 ⇒ match e2 with - [ x0 ⇒ x5 | x1 ⇒ x4 | x2 ⇒ x7 | x3 ⇒ x6 - | x4 ⇒ x1 | x5 ⇒ x0 | x6 ⇒ x3 | x7 ⇒ x2 - | x8 ⇒ xD | x9 ⇒ xC | xA ⇒ xF | xB ⇒ xE - | xC ⇒ x9 | xD ⇒ x8 | xE ⇒ xB | xF ⇒ xA ] - | x6 ⇒ match e2 with - [ x0 ⇒ x6 | x1 ⇒ x7 | x2 ⇒ x4 | x3 ⇒ x5 - | x4 ⇒ x2 | x5 ⇒ x3 | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ xC | xB ⇒ xD - | xC ⇒ xA | xD ⇒ xB | xE ⇒ x8 | xF ⇒ x9 ] - | x7 ⇒ match e2 with - [ x0 ⇒ x7 | x1 ⇒ x6 | x2 ⇒ x5 | x3 ⇒ x4 - | x4 ⇒ x3 | x5 ⇒ x2 | x6 ⇒ x1 | x7 ⇒ x0 - | x8 ⇒ xF | x9 ⇒ xE | xA ⇒ xD | xB ⇒ xC - | xC ⇒ xB | xD ⇒ xA | xE ⇒ x9 | xF ⇒ x8 ] - | x8 ⇒ match e2 with - [ x0 ⇒ x8 | x1 ⇒ x9 | x2 ⇒ xA | x3 ⇒ xB - | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 - | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ] - | x9 ⇒ match e2 with - [ x0 ⇒ x9 | x1 ⇒ x8 | x2 ⇒ xB | x3 ⇒ xA - | x4 ⇒ xD | x5 ⇒ xC | x6 ⇒ xF | x7 ⇒ xE - | x8 ⇒ x1 | x9 ⇒ x0 | xA ⇒ x3 | xB ⇒ x2 - | xC ⇒ x5 | xD ⇒ x4 | xE ⇒ x7 | xF ⇒ x6 ] - | xA ⇒ match e2 with - [ x0 ⇒ xA | x1 ⇒ xB | x2 ⇒ x8 | x3 ⇒ x9 - | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ xC | x7 ⇒ xD - | x8 ⇒ x2 | x9 ⇒ x3 | xA ⇒ x0 | xB ⇒ x1 - | xC ⇒ x6 | xD ⇒ x7 | xE ⇒ x4 | xF ⇒ x5 ] - | xB ⇒ match e2 with - [ x0 ⇒ xB | x1 ⇒ xA | x2 ⇒ x9 | x3 ⇒ x8 - | x4 ⇒ xF | x5 ⇒ xE | x6 ⇒ xD | x7 ⇒ xC - | x8 ⇒ x3 | x9 ⇒ x2 | xA ⇒ x1 | xB ⇒ x0 - | xC ⇒ x7 | xD ⇒ x6 | xE ⇒ x5 | xF ⇒ x4 ] - | xC ⇒ match e2 with - [ x0 ⇒ xC | x1 ⇒ xD | x2 ⇒ xE | x3 ⇒ xF - | x4 ⇒ x8 | x5 ⇒ x9 | x6 ⇒ xA | x7 ⇒ xB - | x8 ⇒ x4 | x9 ⇒ x5 | xA ⇒ x6 | xB ⇒ x7 - | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x2 | xF ⇒ x3 ] - | xD ⇒ match e2 with - [ x0 ⇒ xD | x1 ⇒ xC | x2 ⇒ xF | x3 ⇒ xE - | x4 ⇒ x9 | x5 ⇒ x8 | x6 ⇒ xB | x7 ⇒ xA - | x8 ⇒ x5 | x9 ⇒ x4 | xA ⇒ x7 | xB ⇒ x6 - | xC ⇒ x1 | xD ⇒ x0 | xE ⇒ x3 | xF ⇒ x2 ] - | xE ⇒ match e2 with - [ x0 ⇒ xE | x1 ⇒ xF | x2 ⇒ xC | x3 ⇒ xD - | x4 ⇒ xA | x5 ⇒ xB | x6 ⇒ x8 | x7 ⇒ x9 - | x8 ⇒ x6 | x9 ⇒ x7 | xA ⇒ x4 | xB ⇒ x5 - | xC ⇒ x2 | xD ⇒ x3 | xE ⇒ x0 | xF ⇒ x1 ] - | xF ⇒ match e2 with - [ x0 ⇒ xF | x1 ⇒ xE | x2 ⇒ xD | x3 ⇒ xC - | x4 ⇒ xB | x5 ⇒ xA | x6 ⇒ x9 | x7 ⇒ x8 - | x8 ⇒ x7 | x9 ⇒ x6 | xA ⇒ x5 | xB ⇒ x4 - | xC ⇒ x3 | xD ⇒ x2 | xE ⇒ x1 | xF ⇒ x0 ] - ]. - -(* operatore rotazione destra con carry *) -ndefinition rcr_ex ≝ -λe:exadecim.λc:bool.match c with - [ true ⇒ match e with - [ x0 ⇒ pair exadecim bool x8 false | x1 ⇒ pair exadecim bool x8 true - | x2 ⇒ pair exadecim bool x9 false | x3 ⇒ pair exadecim bool x9 true - | x4 ⇒ pair exadecim bool xA false | x5 ⇒ pair exadecim bool xA true - | x6 ⇒ pair exadecim bool xB false | x7 ⇒ pair exadecim bool xB true - | x8 ⇒ pair exadecim bool xC false | x9 ⇒ pair exadecim bool xC true - | xA ⇒ pair exadecim bool xD false | xB ⇒ pair exadecim bool xD true - | xC ⇒ pair exadecim bool xE false | xD ⇒ pair exadecim bool xE true - | xE ⇒ pair exadecim bool xF false | xF ⇒ pair exadecim bool xF true ] - | false ⇒ match e with - [ x0 ⇒ pair exadecim bool x0 false | x1 ⇒ pair exadecim bool x0 true - | x2 ⇒ pair exadecim bool x1 false | x3 ⇒ pair exadecim bool x1 true - | x4 ⇒ pair exadecim bool x2 false | x5 ⇒ pair exadecim bool x2 true - | x6 ⇒ pair exadecim bool x3 false | x7 ⇒ pair exadecim bool x3 true - | x8 ⇒ pair exadecim bool x4 false | x9 ⇒ pair exadecim bool x4 true - | xA ⇒ pair exadecim bool x5 false | xB ⇒ pair exadecim bool x5 true - | xC ⇒ pair exadecim bool x6 false | xD ⇒ pair exadecim bool x6 true - | xE ⇒ pair exadecim bool x7 false | xF ⇒ pair exadecim bool x7 true ] - ]. - -(* operatore shift destro *) -ndefinition shr_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ pair exadecim bool x0 false | x1 ⇒ pair exadecim bool x0 true - | x2 ⇒ pair exadecim bool x1 false | x3 ⇒ pair exadecim bool x1 true - | x4 ⇒ pair exadecim bool x2 false | x5 ⇒ pair exadecim bool x2 true - | x6 ⇒ pair exadecim bool x3 false | x7 ⇒ pair exadecim bool x3 true - | x8 ⇒ pair exadecim bool x4 false | x9 ⇒ pair exadecim bool x4 true - | xA ⇒ pair exadecim bool x5 false | xB ⇒ pair exadecim bool x5 true - | xC ⇒ pair exadecim bool x6 false | xD ⇒ pair exadecim bool x6 true - | xE ⇒ pair exadecim bool x7 false | xF ⇒ pair exadecim bool x7 true ]. - -(* operatore rotazione destra *) -ndefinition ror_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ x0 | x1 ⇒ x8 | x2 ⇒ x1 | x3 ⇒ x9 - | x4 ⇒ x2 | x5 ⇒ xA | x6 ⇒ x3 | x7 ⇒ xB - | x8 ⇒ x4 | x9 ⇒ xC | xA ⇒ x5 | xB ⇒ xD - | xC ⇒ x6 | xD ⇒ xE | xE ⇒ x7 | xF ⇒ xF ]. - -(* operatore rotazione destra n-volte *) -nlet rec ror_ex_n (e:exadecim) (n:nat) on n ≝ - match n with - [ O ⇒ e - | S n' ⇒ ror_ex_n (ror_ex e) n' ]. - -(* operatore rotazione sinistra con carry *) -ndefinition rcl_ex ≝ -λe:exadecim.λc:bool.match c with - [ true ⇒ match e with - [ x0 ⇒ pair exadecim bool x1 false | x1 ⇒ pair exadecim bool x3 false - | x2 ⇒ pair exadecim bool x5 false | x3 ⇒ pair exadecim bool x7 false - | x4 ⇒ pair exadecim bool x9 false | x5 ⇒ pair exadecim bool xB false - | x6 ⇒ pair exadecim bool xD false | x7 ⇒ pair exadecim bool xF false - | x8 ⇒ pair exadecim bool x1 true | x9 ⇒ pair exadecim bool x3 true - | xA ⇒ pair exadecim bool x5 true | xB ⇒ pair exadecim bool x7 true - | xC ⇒ pair exadecim bool x9 true | xD ⇒ pair exadecim bool xB true - | xE ⇒ pair exadecim bool xD true | xF ⇒ pair exadecim bool xF true ] - | false ⇒ match e with - [ x0 ⇒ pair exadecim bool x0 false | x1 ⇒ pair exadecim bool x2 false - | x2 ⇒ pair exadecim bool x4 false | x3 ⇒ pair exadecim bool x6 false - | x4 ⇒ pair exadecim bool x8 false | x5 ⇒ pair exadecim bool xA false - | x6 ⇒ pair exadecim bool xC false | x7 ⇒ pair exadecim bool xE false - | x8 ⇒ pair exadecim bool x0 true | x9 ⇒ pair exadecim bool x2 true - | xA ⇒ pair exadecim bool x4 true | xB ⇒ pair exadecim bool x6 true - | xC ⇒ pair exadecim bool x8 true | xD ⇒ pair exadecim bool xA true - | xE ⇒ pair exadecim bool xC true | xF ⇒ pair exadecim bool xE true ] - ]. - -(* operatore shift sinistro *) -ndefinition shl_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ pair exadecim bool x0 false | x1 ⇒ pair exadecim bool x2 false - | x2 ⇒ pair exadecim bool x4 false | x3 ⇒ pair exadecim bool x6 false - | x4 ⇒ pair exadecim bool x8 false | x5 ⇒ pair exadecim bool xA false - | x6 ⇒ pair exadecim bool xC false | x7 ⇒ pair exadecim bool xE false - | x8 ⇒ pair exadecim bool x0 true | x9 ⇒ pair exadecim bool x2 true - | xA ⇒ pair exadecim bool x4 true | xB ⇒ pair exadecim bool x6 true - | xC ⇒ pair exadecim bool x8 true | xD ⇒ pair exadecim bool xA true - | xE ⇒ pair exadecim bool xC true | xF ⇒ pair exadecim bool xE true ]. - -(* operatore rotazione sinistra *) -ndefinition rol_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ x0 | x1 ⇒ x2 | x2 ⇒ x4 | x3 ⇒ x6 - | x4 ⇒ x8 | x5 ⇒ xA | x6 ⇒ xC | x7 ⇒ xE - | x8 ⇒ x1 | x9 ⇒ x3 | xA ⇒ x5 | xB ⇒ x7 - | xC ⇒ x9 | xD ⇒ xB | xE ⇒ xD | xF ⇒ xF ]. - -(* operatore rotazione sinistra n-volte *) -nlet rec rol_ex_n (e:exadecim) (n:nat) on n ≝ - match n with - [ O ⇒ e - | S n' ⇒ rol_ex_n (rol_ex e) n' ]. - -(* operatore not/complemento a 1 *) -ndefinition not_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ xF | x1 ⇒ xE | x2 ⇒ xD | x3 ⇒ xC - | x4 ⇒ xB | x5 ⇒ xA | x6 ⇒ x9 | x7 ⇒ x8 - | x8 ⇒ x7 | x9 ⇒ x6 | xA ⇒ x5 | xB ⇒ x4 - | xC ⇒ x3 | xD ⇒ x2 | xE ⇒ x1 | xF ⇒ x0 ]. - -(* operatore somma con data+carry → data+carry *) -ndefinition plus_ex_dc_dc ≝ -λe1,e2:exadecim.λc:bool. - match c with - [ true ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ pair … x1 false | x1 ⇒ pair … x2 false | x2 ⇒ pair … x3 false | x3 ⇒ pair … x4 false - | x4 ⇒ pair … x5 false | x5 ⇒ pair … x6 false | x6 ⇒ pair … x7 false | x7 ⇒ pair … x8 false - | x8 ⇒ pair … x9 false | x9 ⇒ pair … xA false | xA ⇒ pair … xB false | xB ⇒ pair … xC false - | xC ⇒ pair … xD false | xD ⇒ pair … xE false | xE ⇒ pair … xF false | xF ⇒ pair … x0 true ] - | x1 ⇒ match e2 with - [ x0 ⇒ pair … x2 false | x1 ⇒ pair … x3 false | x2 ⇒ pair … x4 false | x3 ⇒ pair … x5 false - | x4 ⇒ pair … x6 false | x5 ⇒ pair … x7 false | x6 ⇒ pair … x8 false | x7 ⇒ pair … x9 false - | x8 ⇒ pair … xA false | x9 ⇒ pair … xB false | xA ⇒ pair … xC false | xB ⇒ pair … xD false - | xC ⇒ pair … xE false | xD ⇒ pair … xF false | xE ⇒ pair … x0 true | xF ⇒ pair … x1 true ] - | x2 ⇒ match e2 with - [ x0 ⇒ pair … x3 false | x1 ⇒ pair … x4 false | x2 ⇒ pair … x5 false | x3 ⇒ pair … x6 false - | x4 ⇒ pair … x7 false | x5 ⇒ pair … x8 false | x6 ⇒ pair … x9 false | x7 ⇒ pair … xA false - | x8 ⇒ pair … xB false | x9 ⇒ pair … xC false | xA ⇒ pair … xD false | xB ⇒ pair … xE false - | xC ⇒ pair … xF false | xD ⇒ pair … x0 true | xE ⇒ pair … x1 true | xF ⇒ pair … x2 true ] - | x3 ⇒ match e2 with - [ x0 ⇒ pair … x4 false | x1 ⇒ pair … x5 false | x2 ⇒ pair … x6 false | x3 ⇒ pair … x7 false - | x4 ⇒ pair … x8 false | x5 ⇒ pair … x9 false | x6 ⇒ pair … xA false | x7 ⇒ pair … xB false - | x8 ⇒ pair … xC false | x9 ⇒ pair … xD false | xA ⇒ pair … xE false | xB ⇒ pair … xF false - | xC ⇒ pair … x0 true | xD ⇒ pair … x1 true | xE ⇒ pair … x2 true | xF ⇒ pair … x3 true ] - | x4 ⇒ match e2 with - [ x0 ⇒ pair … x5 false | x1 ⇒ pair … x6 false | x2 ⇒ pair … x7 false | x3 ⇒ pair … x8 false - | x4 ⇒ pair … x9 false | x5 ⇒ pair … xA false | x6 ⇒ pair … xB false | x7 ⇒ pair … xC false - | x8 ⇒ pair … xD false | x9 ⇒ pair … xE false | xA ⇒ pair … xF false | xB ⇒ pair … x0 true - | xC ⇒ pair … x1 true | xD ⇒ pair … x2 true | xE ⇒ pair … x3 true | xF ⇒ pair … x4 true ] - | x5 ⇒ match e2 with - [ x0 ⇒ pair … x6 false | x1 ⇒ pair … x7 false | x2 ⇒ pair … x8 false | x3 ⇒ pair … x9 false - | x4 ⇒ pair … xA false | x5 ⇒ pair … xB false | x6 ⇒ pair … xC false | x7 ⇒ pair … xD false - | x8 ⇒ pair … xE false | x9 ⇒ pair … xF false | xA ⇒ pair … x0 true | xB ⇒ pair … x1 true - | xC ⇒ pair … x2 true | xD ⇒ pair … x3 true | xE ⇒ pair … x4 true | xF ⇒ pair … x5 true ] - | x6 ⇒ match e2 with - [ x0 ⇒ pair … x7 false | x1 ⇒ pair … x8 false | x2 ⇒ pair … x9 false | x3 ⇒ pair … xA false - | x4 ⇒ pair … xB false | x5 ⇒ pair … xC false | x6 ⇒ pair … xD false | x7 ⇒ pair … xE false - | x8 ⇒ pair … xF false | x9 ⇒ pair … x0 true | xA ⇒ pair … x1 true | xB ⇒ pair … x2 true - | xC ⇒ pair … x3 true | xD ⇒ pair … x4 true | xE ⇒ pair … x5 true | xF ⇒ pair … x6 true ] - | x7 ⇒ match e2 with - [ x0 ⇒ pair … x8 false | x1 ⇒ pair … x9 false | x2 ⇒ pair … xA false | x3 ⇒ pair … xB false - | x4 ⇒ pair … xC false | x5 ⇒ pair … xD false | x6 ⇒ pair … xE false | x7 ⇒ pair … xF false - | x8 ⇒ pair … x0 true | x9 ⇒ pair … x1 true | xA ⇒ pair … x2 true | xB ⇒ pair … x3 true - | xC ⇒ pair … x4 true | xD ⇒ pair … x5 true | xE ⇒ pair … x6 true | xF ⇒ pair … x7 true ] - | x8 ⇒ match e2 with - [ x0 ⇒ pair … x9 false | x1 ⇒ pair … xA false | x2 ⇒ pair … xB false | x3 ⇒ pair … xC false - | x4 ⇒ pair … xD false | x5 ⇒ pair … xE false | x6 ⇒ pair … xF false | x7 ⇒ pair … x0 true - | x8 ⇒ pair … x1 true | x9 ⇒ pair … x2 true | xA ⇒ pair … x3 true | xB ⇒ pair … x4 true - | xC ⇒ pair … x5 true | xD ⇒ pair … x6 true | xE ⇒ pair … x7 true | xF ⇒ pair … x8 true ] - | x9 ⇒ match e2 with - [ x0 ⇒ pair … xA false | x1 ⇒ pair … xB false | x2 ⇒ pair … xC false | x3 ⇒ pair … xD false - | x4 ⇒ pair … xE false | x5 ⇒ pair … xF false | x6 ⇒ pair … x0 true | x7 ⇒ pair … x1 true - | x8 ⇒ pair … x2 true | x9 ⇒ pair … x3 true | xA ⇒ pair … x4 true | xB ⇒ pair … x5 true - | xC ⇒ pair … x6 true | xD ⇒ pair … x7 true | xE ⇒ pair … x8 true | xF ⇒ pair … x9 true ] - | xA ⇒ match e2 with - [ x0 ⇒ pair … xB false | x1 ⇒ pair … xC false | x2 ⇒ pair … xD false | x3 ⇒ pair … xE false - | x4 ⇒ pair … xF false | x5 ⇒ pair … x0 true | x6 ⇒ pair … x1 true | x7 ⇒ pair … x2 true - | x8 ⇒ pair … x3 true | x9 ⇒ pair … x4 true | xA ⇒ pair … x5 true | xB ⇒ pair … x6 true - | xC ⇒ pair … x7 true | xD ⇒ pair … x8 true | xE ⇒ pair … x9 true | xF ⇒ pair … xA true ] - | xB ⇒ match e2 with - [ x0 ⇒ pair … xC false | x1 ⇒ pair … xD false | x2 ⇒ pair … xE false | x3 ⇒ pair … xF false - | x4 ⇒ pair … x0 true | x5 ⇒ pair … x1 true | x6 ⇒ pair … x2 true | x7 ⇒ pair … x3 true - | x8 ⇒ pair … x4 true | x9 ⇒ pair … x5 true | xA ⇒ pair … x6 true | xB ⇒ pair … x7 true - | xC ⇒ pair … x8 true | xD ⇒ pair … x9 true | xE ⇒ pair … xA true | xF ⇒ pair … xB true ] - | xC ⇒ match e2 with - [ x0 ⇒ pair … xD false | x1 ⇒ pair … xE false | x2 ⇒ pair … xF false | x3 ⇒ pair … x0 true - | x4 ⇒ pair … x1 true | x5 ⇒ pair … x2 true | x6 ⇒ pair … x3 true | x7 ⇒ pair … x4 true - | x8 ⇒ pair … x5 true | x9 ⇒ pair … x6 true | xA ⇒ pair … x7 true | xB ⇒ pair … x8 true - | xC ⇒ pair … x9 true | xD ⇒ pair … xA true | xE ⇒ pair … xB true | xF ⇒ pair … xC true ] - | xD ⇒ match e2 with - [ x0 ⇒ pair … xE false | x1 ⇒ pair … xF false | x2 ⇒ pair … x0 true | x3 ⇒ pair … x1 true - | x4 ⇒ pair … x2 true | x5 ⇒ pair … x3 true | x6 ⇒ pair … x4 true | x7 ⇒ pair … x5 true - | x8 ⇒ pair … x6 true | x9 ⇒ pair … x7 true | xA ⇒ pair … x8 true | xB ⇒ pair … x9 true - | xC ⇒ pair … xA true | xD ⇒ pair … xB true | xE ⇒ pair … xC true | xF ⇒ pair … xD true ] - | xE ⇒ match e2 with - [ x0 ⇒ pair … xF false | x1 ⇒ pair … x0 true | x2 ⇒ pair … x1 true | x3 ⇒ pair … x2 true - | x4 ⇒ pair … x3 true | x5 ⇒ pair … x4 true | x6 ⇒ pair … x5 true | x7 ⇒ pair … x6 true - | x8 ⇒ pair … x7 true | x9 ⇒ pair … x8 true | xA ⇒ pair … x9 true | xB ⇒ pair … xA true - | xC ⇒ pair … xB true | xD ⇒ pair … xC true | xE ⇒ pair … xD true | xF ⇒ pair … xE true ] - | xF ⇒ match e2 with - [ x0 ⇒ pair … x0 true | x1 ⇒ pair … x1 true | x2 ⇒ pair … x2 true | x3 ⇒ pair … x3 true - | x4 ⇒ pair … x4 true | x5 ⇒ pair … x5 true | x6 ⇒ pair … x6 true | x7 ⇒ pair … x7 true - | x8 ⇒ pair … x8 true | x9 ⇒ pair … x9 true | xA ⇒ pair … xA true | xB ⇒ pair … xB true - | xC ⇒ pair … xC true | xD ⇒ pair … xD true | xE ⇒ pair … xE true | xF ⇒ pair … xF true ] - ] - | false ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ pair … x0 false | x1 ⇒ pair … x1 false | x2 ⇒ pair … x2 false | x3 ⇒ pair … x3 false - | x4 ⇒ pair … x4 false | x5 ⇒ pair … x5 false | x6 ⇒ pair … x6 false | x7 ⇒ pair … x7 false - | x8 ⇒ pair … x8 false | x9 ⇒ pair … x9 false | xA ⇒ pair … xA false | xB ⇒ pair … xB false - | xC ⇒ pair … xC false | xD ⇒ pair … xD false | xE ⇒ pair … xE false | xF ⇒ pair … xF false ] - | x1 ⇒ match e2 with - [ x0 ⇒ pair … x1 false | x1 ⇒ pair … x2 false | x2 ⇒ pair … x3 false | x3 ⇒ pair … x4 false - | x4 ⇒ pair … x5 false | x5 ⇒ pair … x6 false | x6 ⇒ pair … x7 false | x7 ⇒ pair … x8 false - | x8 ⇒ pair … x9 false | x9 ⇒ pair … xA false | xA ⇒ pair … xB false | xB ⇒ pair … xC false - | xC ⇒ pair … xD false | xD ⇒ pair … xE false | xE ⇒ pair … xF false | xF ⇒ pair … x0 true ] - | x2 ⇒ match e2 with - [ x0 ⇒ pair … x2 false | x1 ⇒ pair … x3 false | x2 ⇒ pair … x4 false | x3 ⇒ pair … x5 false - | x4 ⇒ pair … x6 false | x5 ⇒ pair … x7 false | x6 ⇒ pair … x8 false | x7 ⇒ pair … x9 false - | x8 ⇒ pair … xA false | x9 ⇒ pair … xB false | xA ⇒ pair … xC false | xB ⇒ pair … xD false - | xC ⇒ pair … xE false | xD ⇒ pair … xF false | xE ⇒ pair … x0 true | xF ⇒ pair … x1 true ] - | x3 ⇒ match e2 with - [ x0 ⇒ pair … x3 false | x1 ⇒ pair … x4 false | x2 ⇒ pair … x5 false | x3 ⇒ pair … x6 false - | x4 ⇒ pair … x7 false | x5 ⇒ pair … x8 false | x6 ⇒ pair … x9 false | x7 ⇒ pair … xA false - | x8 ⇒ pair … xB false | x9 ⇒ pair … xC false | xA ⇒ pair … xD false | xB ⇒ pair … xE false - | xC ⇒ pair … xF false | xD ⇒ pair … x0 true | xE ⇒ pair … x1 true | xF ⇒ pair … x2 true ] - | x4 ⇒ match e2 with - [ x0 ⇒ pair … x4 false | x1 ⇒ pair … x5 false | x2 ⇒ pair … x6 false | x3 ⇒ pair … x7 false - | x4 ⇒ pair … x8 false | x5 ⇒ pair … x9 false | x6 ⇒ pair … xA false | x7 ⇒ pair … xB false - | x8 ⇒ pair … xC false | x9 ⇒ pair … xD false | xA ⇒ pair … xE false | xB ⇒ pair … xF false - | xC ⇒ pair … x0 true | xD ⇒ pair … x1 true | xE ⇒ pair … x2 true | xF ⇒ pair … x3 true ] - | x5 ⇒ match e2 with - [ x0 ⇒ pair … x5 false | x1 ⇒ pair … x6 false | x2 ⇒ pair … x7 false | x3 ⇒ pair … x8 false - | x4 ⇒ pair … x9 false | x5 ⇒ pair … xA false | x6 ⇒ pair … xB false | x7 ⇒ pair … xC false - | x8 ⇒ pair … xD false | x9 ⇒ pair … xE false | xA ⇒ pair … xF false | xB ⇒ pair … x0 true - | xC ⇒ pair … x1 true | xD ⇒ pair … x2 true | xE ⇒ pair … x3 true | xF ⇒ pair … x4 true ] - | x6 ⇒ match e2 with - [ x0 ⇒ pair … x6 false | x1 ⇒ pair … x7 false | x2 ⇒ pair … x8 false | x3 ⇒ pair … x9 false - | x4 ⇒ pair … xA false | x5 ⇒ pair … xB false | x6 ⇒ pair … xC false | x7 ⇒ pair … xD false - | x8 ⇒ pair … xE false | x9 ⇒ pair … xF false | xA ⇒ pair … x0 true | xB ⇒ pair … x1 true - | xC ⇒ pair … x2 true | xD ⇒ pair … x3 true | xE ⇒ pair … x4 true | xF ⇒ pair … x5 true ] - | x7 ⇒ match e2 with - [ x0 ⇒ pair … x7 false | x1 ⇒ pair … x8 false | x2 ⇒ pair … x9 false | x3 ⇒ pair … xA false - | x4 ⇒ pair … xB false | x5 ⇒ pair … xC false | x6 ⇒ pair … xD false | x7 ⇒ pair … xE false - | x8 ⇒ pair … xF false | x9 ⇒ pair … x0 true | xA ⇒ pair … x1 true | xB ⇒ pair … x2 true - | xC ⇒ pair … x3 true | xD ⇒ pair … x4 true | xE ⇒ pair … x5 true | xF ⇒ pair … x6 true ] - | x8 ⇒ match e2 with - [ x0 ⇒ pair … x8 false | x1 ⇒ pair … x9 false | x2 ⇒ pair … xA false | x3 ⇒ pair … xB false - | x4 ⇒ pair … xC false | x5 ⇒ pair … xD false | x6 ⇒ pair … xE false | x7 ⇒ pair … xF false - | x8 ⇒ pair … x0 true | x9 ⇒ pair … x1 true | xA ⇒ pair … x2 true | xB ⇒ pair … x3 true - | xC ⇒ pair … x4 true | xD ⇒ pair … x5 true | xE ⇒ pair … x6 true | xF ⇒ pair … x7 true ] - | x9 ⇒ match e2 with - [ x0 ⇒ pair … x9 false | x1 ⇒ pair … xA false | x2 ⇒ pair … xB false | x3 ⇒ pair … xC false - | x4 ⇒ pair … xD false | x5 ⇒ pair … xE false | x6 ⇒ pair … xF false | x7 ⇒ pair … x0 true - | x8 ⇒ pair … x1 true | x9 ⇒ pair … x2 true | xA ⇒ pair … x3 true | xB ⇒ pair … x4 true - | xC ⇒ pair … x5 true | xD ⇒ pair … x6 true | xE ⇒ pair … x7 true | xF ⇒ pair … x8 true ] - | xA ⇒ match e2 with - [ x0 ⇒ pair … xA false | x1 ⇒ pair … xB false | x2 ⇒ pair … xC false | x3 ⇒ pair … xD false - | x4 ⇒ pair … xE false | x5 ⇒ pair … xF false | x6 ⇒ pair … x0 true | x7 ⇒ pair … x1 true - | x8 ⇒ pair … x2 true | x9 ⇒ pair … x3 true | xA ⇒ pair … x4 true | xB ⇒ pair … x5 true - | xC ⇒ pair … x6 true | xD ⇒ pair … x7 true | xE ⇒ pair … x8 true | xF ⇒ pair … x9 true ] - | xB ⇒ match e2 with - [ x0 ⇒ pair … xB false | x1 ⇒ pair … xC false | x2 ⇒ pair … xD false | x3 ⇒ pair … xE false - | x4 ⇒ pair … xF false | x5 ⇒ pair … x0 true | x6 ⇒ pair … x1 true | x7 ⇒ pair … x2 true - | x8 ⇒ pair … x3 true | x9 ⇒ pair … x4 true | xA ⇒ pair … x5 true | xB ⇒ pair … x6 true - | xC ⇒ pair … x7 true | xD ⇒ pair … x8 true | xE ⇒ pair … x9 true | xF ⇒ pair … xA true ] - | xC ⇒ match e2 with - [ x0 ⇒ pair … xC false | x1 ⇒ pair … xD false | x2 ⇒ pair … xE false | x3 ⇒ pair … xF false - | x4 ⇒ pair … x0 true | x5 ⇒ pair … x1 true | x6 ⇒ pair … x2 true | x7 ⇒ pair … x3 true - | x8 ⇒ pair … x4 true | x9 ⇒ pair … x5 true | xA ⇒ pair … x6 true | xB ⇒ pair … x7 true - | xC ⇒ pair … x8 true | xD ⇒ pair … x9 true | xE ⇒ pair … xA true | xF ⇒ pair … xB true ] - | xD ⇒ match e2 with - [ x0 ⇒ pair … xD false | x1 ⇒ pair … xE false | x2 ⇒ pair … xF false | x3 ⇒ pair … x0 true - | x4 ⇒ pair … x1 true | x5 ⇒ pair … x2 true | x6 ⇒ pair … x3 true | x7 ⇒ pair … x4 true - | x8 ⇒ pair … x5 true | x9 ⇒ pair … x6 true | xA ⇒ pair … x7 true | xB ⇒ pair … x8 true - | xC ⇒ pair … x9 true | xD ⇒ pair … xA true | xE ⇒ pair … xB true | xF ⇒ pair … xC true ] - | xE ⇒ match e2 with - [ x0 ⇒ pair … xE false | x1 ⇒ pair … xF false | x2 ⇒ pair … x0 true | x3 ⇒ pair … x1 true - | x4 ⇒ pair … x2 true | x5 ⇒ pair … x3 true | x6 ⇒ pair … x4 true | x7 ⇒ pair … x5 true - | x8 ⇒ pair … x6 true | x9 ⇒ pair … x7 true | xA ⇒ pair … x8 true | xB ⇒ pair … x9 true - | xC ⇒ pair … xA true | xD ⇒ pair … xB true | xE ⇒ pair … xC true | xF ⇒ pair … xD true ] - | xF ⇒ match e2 with - [ x0 ⇒ pair … xF false | x1 ⇒ pair … x0 true | x2 ⇒ pair … x1 true | x3 ⇒ pair … x2 true - | x4 ⇒ pair … x3 true | x5 ⇒ pair … x4 true | x6 ⇒ pair … x5 true | x7 ⇒ pair … x6 true - | x8 ⇒ pair … x7 true | x9 ⇒ pair … x8 true | xA ⇒ pair … x9 true | xB ⇒ pair … xA true - | xC ⇒ pair … xB true | xD ⇒ pair … xC true | xE ⇒ pair … xD true | xF ⇒ pair … xE true ] - ]]. - -(* operatore somma con data → data+carry *) -ndefinition plus_ex_d_dc ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ pair … x0 false | x1 ⇒ pair … x1 false | x2 ⇒ pair … x2 false | x3 ⇒ pair … x3 false - | x4 ⇒ pair … x4 false | x5 ⇒ pair … x5 false | x6 ⇒ pair … x6 false | x7 ⇒ pair … x7 false - | x8 ⇒ pair … x8 false | x9 ⇒ pair … x9 false | xA ⇒ pair … xA false | xB ⇒ pair … xB false - | xC ⇒ pair … xC false | xD ⇒ pair … xD false | xE ⇒ pair … xE false | xF ⇒ pair … xF false ] - | x1 ⇒ match e2 with - [ x0 ⇒ pair … x1 false | x1 ⇒ pair … x2 false | x2 ⇒ pair … x3 false | x3 ⇒ pair … x4 false - | x4 ⇒ pair … x5 false | x5 ⇒ pair … x6 false | x6 ⇒ pair … x7 false | x7 ⇒ pair … x8 false - | x8 ⇒ pair … x9 false | x9 ⇒ pair … xA false | xA ⇒ pair … xB false | xB ⇒ pair … xC false - | xC ⇒ pair … xD false | xD ⇒ pair … xE false | xE ⇒ pair … xF false | xF ⇒ pair … x0 true ] - | x2 ⇒ match e2 with - [ x0 ⇒ pair … x2 false | x1 ⇒ pair … x3 false | x2 ⇒ pair … x4 false | x3 ⇒ pair … x5 false - | x4 ⇒ pair … x6 false | x5 ⇒ pair … x7 false | x6 ⇒ pair … x8 false | x7 ⇒ pair … x9 false - | x8 ⇒ pair … xA false | x9 ⇒ pair … xB false | xA ⇒ pair … xC false | xB ⇒ pair … xD false - | xC ⇒ pair … xE false | xD ⇒ pair … xF false | xE ⇒ pair … x0 true | xF ⇒ pair … x1 true ] - | x3 ⇒ match e2 with - [ x0 ⇒ pair … x3 false | x1 ⇒ pair … x4 false | x2 ⇒ pair … x5 false | x3 ⇒ pair … x6 false - | x4 ⇒ pair … x7 false | x5 ⇒ pair … x8 false | x6 ⇒ pair … x9 false | x7 ⇒ pair … xA false - | x8 ⇒ pair … xB false | x9 ⇒ pair … xC false | xA ⇒ pair … xD false | xB ⇒ pair … xE false - | xC ⇒ pair … xF false | xD ⇒ pair … x0 true | xE ⇒ pair … x1 true | xF ⇒ pair … x2 true ] - | x4 ⇒ match e2 with - [ x0 ⇒ pair … x4 false | x1 ⇒ pair … x5 false | x2 ⇒ pair … x6 false | x3 ⇒ pair … x7 false - | x4 ⇒ pair … x8 false | x5 ⇒ pair … x9 false | x6 ⇒ pair … xA false | x7 ⇒ pair … xB false - | x8 ⇒ pair … xC false | x9 ⇒ pair … xD false | xA ⇒ pair … xE false | xB ⇒ pair … xF false - | xC ⇒ pair … x0 true | xD ⇒ pair … x1 true | xE ⇒ pair … x2 true | xF ⇒ pair … x3 true ] - | x5 ⇒ match e2 with - [ x0 ⇒ pair … x5 false | x1 ⇒ pair … x6 false | x2 ⇒ pair … x7 false | x3 ⇒ pair … x8 false - | x4 ⇒ pair … x9 false | x5 ⇒ pair … xA false | x6 ⇒ pair … xB false | x7 ⇒ pair … xC false - | x8 ⇒ pair … xD false | x9 ⇒ pair … xE false | xA ⇒ pair … xF false | xB ⇒ pair … x0 true - | xC ⇒ pair … x1 true | xD ⇒ pair … x2 true | xE ⇒ pair … x3 true | xF ⇒ pair … x4 true ] - | x6 ⇒ match e2 with - [ x0 ⇒ pair … x6 false | x1 ⇒ pair … x7 false | x2 ⇒ pair … x8 false | x3 ⇒ pair … x9 false - | x4 ⇒ pair … xA false | x5 ⇒ pair … xB false | x6 ⇒ pair … xC false | x7 ⇒ pair … xD false - | x8 ⇒ pair … xE false | x9 ⇒ pair … xF false | xA ⇒ pair … x0 true | xB ⇒ pair … x1 true - | xC ⇒ pair … x2 true | xD ⇒ pair … x3 true | xE ⇒ pair … x4 true | xF ⇒ pair … x5 true ] - | x7 ⇒ match e2 with - [ x0 ⇒ pair … x7 false | x1 ⇒ pair … x8 false | x2 ⇒ pair … x9 false | x3 ⇒ pair … xA false - | x4 ⇒ pair … xB false | x5 ⇒ pair … xC false | x6 ⇒ pair … xD false | x7 ⇒ pair … xE false - | x8 ⇒ pair … xF false | x9 ⇒ pair … x0 true | xA ⇒ pair … x1 true | xB ⇒ pair … x2 true - | xC ⇒ pair … x3 true | xD ⇒ pair … x4 true | xE ⇒ pair … x5 true | xF ⇒ pair … x6 true ] - | x8 ⇒ match e2 with - [ x0 ⇒ pair … x8 false | x1 ⇒ pair … x9 false | x2 ⇒ pair … xA false | x3 ⇒ pair … xB false - | x4 ⇒ pair … xC false | x5 ⇒ pair … xD false | x6 ⇒ pair … xE false | x7 ⇒ pair … xF false - | x8 ⇒ pair … x0 true | x9 ⇒ pair … x1 true | xA ⇒ pair … x2 true | xB ⇒ pair … x3 true - | xC ⇒ pair … x4 true | xD ⇒ pair … x5 true | xE ⇒ pair … x6 true | xF ⇒ pair … x7 true ] - | x9 ⇒ match e2 with - [ x0 ⇒ pair … x9 false | x1 ⇒ pair … xA false | x2 ⇒ pair … xB false | x3 ⇒ pair … xC false - | x4 ⇒ pair … xD false | x5 ⇒ pair … xE false | x6 ⇒ pair … xF false | x7 ⇒ pair … x0 true - | x8 ⇒ pair … x1 true | x9 ⇒ pair … x2 true | xA ⇒ pair … x3 true | xB ⇒ pair … x4 true - | xC ⇒ pair … x5 true | xD ⇒ pair … x6 true | xE ⇒ pair … x7 true | xF ⇒ pair … x8 true ] - | xA ⇒ match e2 with - [ x0 ⇒ pair … xA false | x1 ⇒ pair … xB false | x2 ⇒ pair … xC false | x3 ⇒ pair … xD false - | x4 ⇒ pair … xE false | x5 ⇒ pair … xF false | x6 ⇒ pair … x0 true | x7 ⇒ pair … x1 true - | x8 ⇒ pair … x2 true | x9 ⇒ pair … x3 true | xA ⇒ pair … x4 true | xB ⇒ pair … x5 true - | xC ⇒ pair … x6 true | xD ⇒ pair … x7 true | xE ⇒ pair … x8 true | xF ⇒ pair … x9 true ] - | xB ⇒ match e2 with - [ x0 ⇒ pair … xB false | x1 ⇒ pair … xC false | x2 ⇒ pair … xD false | x3 ⇒ pair … xE false - | x4 ⇒ pair … xF false | x5 ⇒ pair … x0 true | x6 ⇒ pair … x1 true | x7 ⇒ pair … x2 true - | x8 ⇒ pair … x3 true | x9 ⇒ pair … x4 true | xA ⇒ pair … x5 true | xB ⇒ pair … x6 true - | xC ⇒ pair … x7 true | xD ⇒ pair … x8 true | xE ⇒ pair … x9 true | xF ⇒ pair … xA true ] - | xC ⇒ match e2 with - [ x0 ⇒ pair … xC false | x1 ⇒ pair … xD false | x2 ⇒ pair … xE false | x3 ⇒ pair … xF false - | x4 ⇒ pair … x0 true | x5 ⇒ pair … x1 true | x6 ⇒ pair … x2 true | x7 ⇒ pair … x3 true - | x8 ⇒ pair … x4 true | x9 ⇒ pair … x5 true | xA ⇒ pair … x6 true | xB ⇒ pair … x7 true - | xC ⇒ pair … x8 true | xD ⇒ pair … x9 true | xE ⇒ pair … xA true | xF ⇒ pair … xB true ] - | xD ⇒ match e2 with - [ x0 ⇒ pair … xD false | x1 ⇒ pair … xE false | x2 ⇒ pair … xF false | x3 ⇒ pair … x0 true - | x4 ⇒ pair … x1 true | x5 ⇒ pair … x2 true | x6 ⇒ pair … x3 true | x7 ⇒ pair … x4 true - | x8 ⇒ pair … x5 true | x9 ⇒ pair … x6 true | xA ⇒ pair … x7 true | xB ⇒ pair … x8 true - | xC ⇒ pair … x9 true | xD ⇒ pair … xA true | xE ⇒ pair … xB true | xF ⇒ pair … xC true ] - | xE ⇒ match e2 with - [ x0 ⇒ pair … xE false | x1 ⇒ pair … xF false | x2 ⇒ pair … x0 true | x3 ⇒ pair … x1 true - | x4 ⇒ pair … x2 true | x5 ⇒ pair … x3 true | x6 ⇒ pair … x4 true | x7 ⇒ pair … x5 true - | x8 ⇒ pair … x6 true | x9 ⇒ pair … x7 true | xA ⇒ pair … x8 true | xB ⇒ pair … x9 true - | xC ⇒ pair … xA true | xD ⇒ pair … xB true | xE ⇒ pair … xC true | xF ⇒ pair … xD true ] - | xF ⇒ match e2 with - [ x0 ⇒ pair … xF false | x1 ⇒ pair … x0 true | x2 ⇒ pair … x1 true | x3 ⇒ pair … x2 true - | x4 ⇒ pair … x3 true | x5 ⇒ pair … x4 true | x6 ⇒ pair … x5 true | x7 ⇒ pair … x6 true - | x8 ⇒ pair … x7 true | x9 ⇒ pair … x8 true | xA ⇒ pair … x9 true | xB ⇒ pair … xA true - | xC ⇒ pair … xB true | xD ⇒ pair … xC true | xE ⇒ pair … xD true | xF ⇒ pair … xE true ] - ]. - -(* operatore somma con data+carry → data *) -ndefinition plus_ex_dc_d ≝ -λe1,e2:exadecim.λc:bool. - match c with - [ true ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x1 | x1 ⇒ x2 | x2 ⇒ x3 | x3 ⇒ x4 | x4 ⇒ x5 | x5 ⇒ x6 | x6 ⇒ x7 | x7 ⇒ x8 - | x8 ⇒ x9 | x9 ⇒ xA | xA ⇒ xB | xB ⇒ xC | xC ⇒ xD | xD ⇒ xE | xE ⇒ xF | xF ⇒ x0 ] - | x1 ⇒ match e2 with - [ x0 ⇒ x2 | x1 ⇒ x3 | x2 ⇒ x4 | x3 ⇒ x5 | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x8 | x7 ⇒ x9 - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ xC | xB ⇒ xD | xC ⇒ xE | xD ⇒ xF | xE ⇒ x0 | xF ⇒ x1 ] - | x2 ⇒ match e2 with - [ x0 ⇒ x3 | x1 ⇒ x4 | x2 ⇒ x5 | x3 ⇒ x6 | x4 ⇒ x7 | x5 ⇒ x8 | x6 ⇒ x9 | x7 ⇒ xA - | x8 ⇒ xB | x9 ⇒ xC | xA ⇒ xD | xB ⇒ xE | xC ⇒ xF | xD ⇒ x0 | xE ⇒ x1 | xF ⇒ x2 ] - | x3 ⇒ match e2 with - [ x0 ⇒ x4 | x1 ⇒ x5 | x2 ⇒ x6 | x3 ⇒ x7 | x4 ⇒ x8 | x5 ⇒ x9 | x6 ⇒ xA | x7 ⇒ xB - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x2 | xF ⇒ x3 ] - | x4 ⇒ match e2 with - [ x0 ⇒ x5 | x1 ⇒ x6 | x2 ⇒ x7 | x3 ⇒ x8 | x4 ⇒ x9 | x5 ⇒ xA | x6 ⇒ xB | x7 ⇒ xC - | x8 ⇒ xD | x9 ⇒ xE | xA ⇒ xF | xB ⇒ x0 | xC ⇒ x1 | xD ⇒ x2 | xE ⇒ x3 | xF ⇒ x4 ] - | x5 ⇒ match e2 with - [ x0 ⇒ x6 | x1 ⇒ x7 | x2 ⇒ x8 | x3 ⇒ x9 | x4 ⇒ xA | x5 ⇒ xB | x6 ⇒ xC | x7 ⇒ xD - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ x0 | xB ⇒ x1 | xC ⇒ x2 | xD ⇒ x3 | xE ⇒ x4 | xF ⇒ x5 ] - | x6 ⇒ match e2 with - [ x0 ⇒ x7 | x1 ⇒ x8 | x2 ⇒ x9 | x3 ⇒ xA | x4 ⇒ xB | x5 ⇒ xC | x6 ⇒ xD | x7 ⇒ xE - | x8 ⇒ xF | x9 ⇒ x0 | xA ⇒ x1 | xB ⇒ x2 | xC ⇒ x3 | xD ⇒ x4 | xE ⇒ x5 | xF ⇒ x6 ] - | x7 ⇒ match e2 with - [ x0 ⇒ x8 | x1 ⇒ x9 | x2 ⇒ xA | x3 ⇒ xB | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ] - | x8 ⇒ match e2 with - [ x0 ⇒ x9 | x1 ⇒ xA | x2 ⇒ xB | x3 ⇒ xC | x4 ⇒ xD | x5 ⇒ xE | x6 ⇒ xF | x7 ⇒ x0 - | x8 ⇒ x1 | x9 ⇒ x2 | xA ⇒ x3 | xB ⇒ x4 | xC ⇒ x5 | xD ⇒ x6 | xE ⇒ x7 | xF ⇒ x8 ] - | x9 ⇒ match e2 with - [ x0 ⇒ xA | x1 ⇒ xB | x2 ⇒ xC | x3 ⇒ xD | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ x2 | x9 ⇒ x3 | xA ⇒ x4 | xB ⇒ x5 | xC ⇒ x6 | xD ⇒ x7 | xE ⇒ x8 | xF ⇒ x9 ] - | xA ⇒ match e2 with - [ x0 ⇒ xB | x1 ⇒ xC | x2 ⇒ xD | x3 ⇒ xE | x4 ⇒ xF | x5 ⇒ x0 | x6 ⇒ x1 | x7 ⇒ x2 - | x8 ⇒ x3 | x9 ⇒ x4 | xA ⇒ x5 | xB ⇒ x6 | xC ⇒ x7 | xD ⇒ x8 | xE ⇒ x9 | xF ⇒ xA ] - | xB ⇒ match e2 with - [ x0 ⇒ xC | x1 ⇒ xD | x2 ⇒ xE | x3 ⇒ xF | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ x4 | x9 ⇒ x5 | xA ⇒ x6 | xB ⇒ x7 | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ xA | xF ⇒ xB ] - | xC ⇒ match e2 with - [ x0 ⇒ xD | x1 ⇒ xE | x2 ⇒ xF | x3 ⇒ x0 | x4 ⇒ x1 | x5 ⇒ x2 | x6 ⇒ x3 | x7 ⇒ x4 - | x8 ⇒ x5 | x9 ⇒ x6 | xA ⇒ x7 | xB ⇒ x8 | xC ⇒ x9 | xD ⇒ xA | xE ⇒ xB | xF ⇒ xC ] - | xD ⇒ match e2 with - [ x0 ⇒ xE | x1 ⇒ xF | x2 ⇒ x0 | x3 ⇒ x1 | x4 ⇒ x2 | x5 ⇒ x3 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ x6 | x9 ⇒ x7 | xA ⇒ x8 | xB ⇒ x9 | xC ⇒ xA | xD ⇒ xB | xE ⇒ xC | xF ⇒ xD ] - | xE ⇒ match e2 with - [ x0 ⇒ xF | x1 ⇒ x0 | x2 ⇒ x1 | x3 ⇒ x2 | x4 ⇒ x3 | x5 ⇒ x4 | x6 ⇒ x5 | x7 ⇒ x6 - | x8 ⇒ x7 | x9 ⇒ x8 | xA ⇒ x9 | xB ⇒ xA | xC ⇒ xB | xD ⇒ xC | xE ⇒ xD | xF ⇒ xE ] - | xF ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - ] - | false ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x1 ⇒ match e2 with - [ x0 ⇒ x1 | x1 ⇒ x2 | x2 ⇒ x3 | x3 ⇒ x4 | x4 ⇒ x5 | x5 ⇒ x6 | x6 ⇒ x7 | x7 ⇒ x8 - | x8 ⇒ x9 | x9 ⇒ xA | xA ⇒ xB | xB ⇒ xC | xC ⇒ xD | xD ⇒ xE | xE ⇒ xF | xF ⇒ x0 ] - | x2 ⇒ match e2 with - [ x0 ⇒ x2 | x1 ⇒ x3 | x2 ⇒ x4 | x3 ⇒ x5 | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x8 | x7 ⇒ x9 - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ xC | xB ⇒ xD | xC ⇒ xE | xD ⇒ xF | xE ⇒ x0 | xF ⇒ x1 ] - | x3 ⇒ match e2 with - [ x0 ⇒ x3 | x1 ⇒ x4 | x2 ⇒ x5 | x3 ⇒ x6 | x4 ⇒ x7 | x5 ⇒ x8 | x6 ⇒ x9 | x7 ⇒ xA - | x8 ⇒ xB | x9 ⇒ xC | xA ⇒ xD | xB ⇒ xE | xC ⇒ xF | xD ⇒ x0 | xE ⇒ x1 | xF ⇒ x2 ] - | x4 ⇒ match e2 with - [ x0 ⇒ x4 | x1 ⇒ x5 | x2 ⇒ x6 | x3 ⇒ x7 | x4 ⇒ x8 | x5 ⇒ x9 | x6 ⇒ xA | x7 ⇒ xB - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x2 | xF ⇒ x3 ] - | x5 ⇒ match e2 with - [ x0 ⇒ x5 | x1 ⇒ x6 | x2 ⇒ x7 | x3 ⇒ x8 | x4 ⇒ x9 | x5 ⇒ xA | x6 ⇒ xB | x7 ⇒ xC - | x8 ⇒ xD | x9 ⇒ xE | xA ⇒ xF | xB ⇒ x0 | xC ⇒ x1 | xD ⇒ x2 | xE ⇒ x3 | xF ⇒ x4 ] - | x6 ⇒ match e2 with - [ x0 ⇒ x6 | x1 ⇒ x7 | x2 ⇒ x8 | x3 ⇒ x9 | x4 ⇒ xA | x5 ⇒ xB | x6 ⇒ xC | x7 ⇒ xD - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ x0 | xB ⇒ x1 | xC ⇒ x2 | xD ⇒ x3 | xE ⇒ x4 | xF ⇒ x5 ] - | x7 ⇒ match e2 with - [ x0 ⇒ x7 | x1 ⇒ x8 | x2 ⇒ x9 | x3 ⇒ xA | x4 ⇒ xB | x5 ⇒ xC | x6 ⇒ xD | x7 ⇒ xE - | x8 ⇒ xF | x9 ⇒ x0 | xA ⇒ x1 | xB ⇒ x2 | xC ⇒ x3 | xD ⇒ x4 | xE ⇒ x5 | xF ⇒ x6 ] - | x8 ⇒ match e2 with - [ x0 ⇒ x8 | x1 ⇒ x9 | x2 ⇒ xA | x3 ⇒ xB | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ] - | x9 ⇒ match e2 with - [ x0 ⇒ x9 | x1 ⇒ xA | x2 ⇒ xB | x3 ⇒ xC | x4 ⇒ xD | x5 ⇒ xE | x6 ⇒ xF | x7 ⇒ x0 - | x8 ⇒ x1 | x9 ⇒ x2 | xA ⇒ x3 | xB ⇒ x4 | xC ⇒ x5 | xD ⇒ x6 | xE ⇒ x7 | xF ⇒ x8 ] - | xA ⇒ match e2 with - [ x0 ⇒ xA | x1 ⇒ xB | x2 ⇒ xC | x3 ⇒ xD | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ x2 | x9 ⇒ x3 | xA ⇒ x4 | xB ⇒ x5 | xC ⇒ x6 | xD ⇒ x7 | xE ⇒ x8 | xF ⇒ x9 ] - | xB ⇒ match e2 with - [ x0 ⇒ xB | x1 ⇒ xC | x2 ⇒ xD | x3 ⇒ xE | x4 ⇒ xF | x5 ⇒ x0 | x6 ⇒ x1 | x7 ⇒ x2 - | x8 ⇒ x3 | x9 ⇒ x4 | xA ⇒ x5 | xB ⇒ x6 | xC ⇒ x7 | xD ⇒ x8 | xE ⇒ x9 | xF ⇒ xA ] - | xC ⇒ match e2 with - [ x0 ⇒ xC | x1 ⇒ xD | x2 ⇒ xE | x3 ⇒ xF | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ x4 | x9 ⇒ x5 | xA ⇒ x6 | xB ⇒ x7 | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ xA | xF ⇒ xB ] - | xD ⇒ match e2 with - [ x0 ⇒ xD | x1 ⇒ xE | x2 ⇒ xF | x3 ⇒ x0 | x4 ⇒ x1 | x5 ⇒ x2 | x6 ⇒ x3 | x7 ⇒ x4 - | x8 ⇒ x5 | x9 ⇒ x6 | xA ⇒ x7 | xB ⇒ x8 | xC ⇒ x9 | xD ⇒ xA | xE ⇒ xB | xF ⇒ xC ] - | xE ⇒ match e2 with - [ x0 ⇒ xE | x1 ⇒ xF | x2 ⇒ x0 | x3 ⇒ x1 | x4 ⇒ x2 | x5 ⇒ x3 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ x6 | x9 ⇒ x7 | xA ⇒ x8 | xB ⇒ x9 | xC ⇒ xA | xD ⇒ xB | xE ⇒ xC | xF ⇒ xD ] - | xF ⇒ match e2 with - [ x0 ⇒ xF | x1 ⇒ x0 | x2 ⇒ x1 | x3 ⇒ x2 | x4 ⇒ x3 | x5 ⇒ x4 | x6 ⇒ x5 | x7 ⇒ x6 - | x8 ⇒ x7 | x9 ⇒ x8 | xA ⇒ x9 | xB ⇒ xA | xC ⇒ xB | xD ⇒ xC | xE ⇒ xD | xF ⇒ xE ] - ]]. - -(* operatore somma con data → data *) -ndefinition plus_ex_d_d ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 - | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ] - | x1 ⇒ match e2 with - [ x0 ⇒ x1 | x1 ⇒ x2 | x2 ⇒ x3 | x3 ⇒ x4 | x4 ⇒ x5 | x5 ⇒ x6 | x6 ⇒ x7 | x7 ⇒ x8 - | x8 ⇒ x9 | x9 ⇒ xA | xA ⇒ xB | xB ⇒ xC | xC ⇒ xD | xD ⇒ xE | xE ⇒ xF | xF ⇒ x0 ] - | x2 ⇒ match e2 with - [ x0 ⇒ x2 | x1 ⇒ x3 | x2 ⇒ x4 | x3 ⇒ x5 | x4 ⇒ x6 | x5 ⇒ x7 | x6 ⇒ x8 | x7 ⇒ x9 - | x8 ⇒ xA | x9 ⇒ xB | xA ⇒ xC | xB ⇒ xD | xC ⇒ xE | xD ⇒ xF | xE ⇒ x0 | xF ⇒ x1 ] - | x3 ⇒ match e2 with - [ x0 ⇒ x3 | x1 ⇒ x4 | x2 ⇒ x5 | x3 ⇒ x6 | x4 ⇒ x7 | x5 ⇒ x8 | x6 ⇒ x9 | x7 ⇒ xA - | x8 ⇒ xB | x9 ⇒ xC | xA ⇒ xD | xB ⇒ xE | xC ⇒ xF | xD ⇒ x0 | xE ⇒ x1 | xF ⇒ x2 ] - | x4 ⇒ match e2 with - [ x0 ⇒ x4 | x1 ⇒ x5 | x2 ⇒ x6 | x3 ⇒ x7 | x4 ⇒ x8 | x5 ⇒ x9 | x6 ⇒ xA | x7 ⇒ xB - | x8 ⇒ xC | x9 ⇒ xD | xA ⇒ xE | xB ⇒ xF | xC ⇒ x0 | xD ⇒ x1 | xE ⇒ x2 | xF ⇒ x3 ] - | x5 ⇒ match e2 with - [ x0 ⇒ x5 | x1 ⇒ x6 | x2 ⇒ x7 | x3 ⇒ x8 | x4 ⇒ x9 | x5 ⇒ xA | x6 ⇒ xB | x7 ⇒ xC - | x8 ⇒ xD | x9 ⇒ xE | xA ⇒ xF | xB ⇒ x0 | xC ⇒ x1 | xD ⇒ x2 | xE ⇒ x3 | xF ⇒ x4 ] - | x6 ⇒ match e2 with - [ x0 ⇒ x6 | x1 ⇒ x7 | x2 ⇒ x8 | x3 ⇒ x9 | x4 ⇒ xA | x5 ⇒ xB | x6 ⇒ xC | x7 ⇒ xD - | x8 ⇒ xE | x9 ⇒ xF | xA ⇒ x0 | xB ⇒ x1 | xC ⇒ x2 | xD ⇒ x3 | xE ⇒ x4 | xF ⇒ x5 ] - | x7 ⇒ match e2 with - [ x0 ⇒ x7 | x1 ⇒ x8 | x2 ⇒ x9 | x3 ⇒ xA | x4 ⇒ xB | x5 ⇒ xC | x6 ⇒ xD | x7 ⇒ xE - | x8 ⇒ xF | x9 ⇒ x0 | xA ⇒ x1 | xB ⇒ x2 | xC ⇒ x3 | xD ⇒ x4 | xE ⇒ x5 | xF ⇒ x6 ] - | x8 ⇒ match e2 with - [ x0 ⇒ x8 | x1 ⇒ x9 | x2 ⇒ xA | x3 ⇒ xB | x4 ⇒ xC | x5 ⇒ xD | x6 ⇒ xE | x7 ⇒ xF - | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ] - | x9 ⇒ match e2 with - [ x0 ⇒ x9 | x1 ⇒ xA | x2 ⇒ xB | x3 ⇒ xC | x4 ⇒ xD | x5 ⇒ xE | x6 ⇒ xF | x7 ⇒ x0 - | x8 ⇒ x1 | x9 ⇒ x2 | xA ⇒ x3 | xB ⇒ x4 | xC ⇒ x5 | xD ⇒ x6 | xE ⇒ x7 | xF ⇒ x8 ] - | xA ⇒ match e2 with - [ x0 ⇒ xA | x1 ⇒ xB | x2 ⇒ xC | x3 ⇒ xD | x4 ⇒ xE | x5 ⇒ xF | x6 ⇒ x0 | x7 ⇒ x1 - | x8 ⇒ x2 | x9 ⇒ x3 | xA ⇒ x4 | xB ⇒ x5 | xC ⇒ x6 | xD ⇒ x7 | xE ⇒ x8 | xF ⇒ x9 ] - | xB ⇒ match e2 with - [ x0 ⇒ xB | x1 ⇒ xC | x2 ⇒ xD | x3 ⇒ xE | x4 ⇒ xF | x5 ⇒ x0 | x6 ⇒ x1 | x7 ⇒ x2 - | x8 ⇒ x3 | x9 ⇒ x4 | xA ⇒ x5 | xB ⇒ x6 | xC ⇒ x7 | xD ⇒ x8 | xE ⇒ x9 | xF ⇒ xA ] - | xC ⇒ match e2 with - [ x0 ⇒ xC | x1 ⇒ xD | x2 ⇒ xE | x3 ⇒ xF | x4 ⇒ x0 | x5 ⇒ x1 | x6 ⇒ x2 | x7 ⇒ x3 - | x8 ⇒ x4 | x9 ⇒ x5 | xA ⇒ x6 | xB ⇒ x7 | xC ⇒ x8 | xD ⇒ x9 | xE ⇒ xA | xF ⇒ xB ] - | xD ⇒ match e2 with - [ x0 ⇒ xD | x1 ⇒ xE | x2 ⇒ xF | x3 ⇒ x0 | x4 ⇒ x1 | x5 ⇒ x2 | x6 ⇒ x3 | x7 ⇒ x4 - | x8 ⇒ x5 | x9 ⇒ x6 | xA ⇒ x7 | xB ⇒ x8 | xC ⇒ x9 | xD ⇒ xA | xE ⇒ xB | xF ⇒ xC ] - | xE ⇒ match e2 with - [ x0 ⇒ xE | x1 ⇒ xF | x2 ⇒ x0 | x3 ⇒ x1 | x4 ⇒ x2 | x5 ⇒ x3 | x6 ⇒ x4 | x7 ⇒ x5 - | x8 ⇒ x6 | x9 ⇒ x7 | xA ⇒ x8 | xB ⇒ x9 | xC ⇒ xA | xD ⇒ xB | xE ⇒ xC | xF ⇒ xD ] - | xF ⇒ match e2 with - [ x0 ⇒ xF | x1 ⇒ x0 | x2 ⇒ x1 | x3 ⇒ x2 | x4 ⇒ x3 | x5 ⇒ x4 | x6 ⇒ x5 | x7 ⇒ x6 - | x8 ⇒ x7 | x9 ⇒ x8 | xA ⇒ x9 | xB ⇒ xA | xC ⇒ xB | xD ⇒ xC | xE ⇒ xD | xF ⇒ xE ] - ]. - -(* operatore somma con data+carry → carry *) -ndefinition plus_ex_dc_c ≝ -λe1,e2:exadecim.λc:bool. - match c with - [ true ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ] - | x1 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ true ] - | x2 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x3 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x4 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x5 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x6 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x7 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x8 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x9 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xA ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xB ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xC ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xD ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xE ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xF ⇒ match e2 with - [ x0 ⇒ true | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - ] - | false ⇒ match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x1 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ] - | x2 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ true ] - | x3 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x4 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x5 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x6 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x7 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x8 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x9 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xA ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xB ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xC ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xD ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xE ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xF ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - ]]. - -(* operatore somma con data → carry *) -ndefinition plus_ex_d_c ≝ -λe1,e2:exadecim. - match e1 with - [ x0 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] - | x1 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ] - | x2 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ true ] - | x3 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ false | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x4 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x5 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x6 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x7 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ false | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x8 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | x9 ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xA ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xB ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ false | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xC ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xD ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xE ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - | xF ⇒ match e2 with - [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ true | x3 ⇒ true | x4 ⇒ true | x5 ⇒ true | x6 ⇒ true | x7 ⇒ true - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ] - ]. - -(* operatore Most Significant Bit *) -ndefinition MSB_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false - | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false - | x8 ⇒ true | x9 ⇒ true | xA ⇒ true | xB ⇒ true - | xC ⇒ true | xD ⇒ true | xE ⇒ true | xF ⇒ true ]. - -(* operatore predecessore *) -ndefinition pred_ex ≝ -λe:exadecim. - match e with - [ x0 ⇒ xF | x1 ⇒ x0 | x2 ⇒ x1 | x3 ⇒ x2 | x4 ⇒ x3 | x5 ⇒ x4 | x6 ⇒ x5 | x7 ⇒ x6 - | x8 ⇒ x7 | x9 ⇒ x8 | xA ⇒ x9 | xB ⇒ xA | xC ⇒ xB | xD ⇒ xC | xE ⇒ xD | xF ⇒ xE ]. - -(* operatore successore *) -ndefinition succ_ex ≝ -λe:exadecim. - match e with - [ x0 ⇒ x1 | x1 ⇒ x2 | x2 ⇒ x3 | x3 ⇒ x4 | x4 ⇒ x5 | x5 ⇒ x6 | x6 ⇒ x7 | x7 ⇒ x8 - | x8 ⇒ x9 | x9 ⇒ xA | xA ⇒ xB | xB ⇒ xC | xC ⇒ xD | xD ⇒ xE | xE ⇒ xF | xF ⇒ x0 ]. - -(* operatore neg/complemento a 2 *) -ndefinition compl_ex ≝ -λe:exadecim.match e with - [ x0 ⇒ x0 | x1 ⇒ xF | x2 ⇒ xE | x3 ⇒ xD - | x4 ⇒ xC | x5 ⇒ xB | x6 ⇒ xA | x7 ⇒ x9 - | x8 ⇒ x8 | x9 ⇒ x7 | xA ⇒ x6 | xB ⇒ x5 - | xC ⇒ x4 | xD ⇒ x3 | xE ⇒ x2 | xF ⇒ x1 ]. - -(* operatore x in [inf,sup] o in sup],[inf *) -ndefinition inrange_ex ≝ -λx,inf,sup:exadecim. - match le_ex inf sup with - [ true ⇒ and_bool | false ⇒ or_bool ] - (le_ex inf x) (le_ex x sup). - -(* iteratore sugli esadecimali *) -ndefinition forall_ex ≝ λP. - P x0 ⊗ P x1 ⊗ P x2 ⊗ P x3 ⊗ P x4 ⊗ P x5 ⊗ P x6 ⊗ P x7 ⊗ - P x8 ⊗ P x9 ⊗ P xA ⊗ P xB ⊗ P xC ⊗ P xD ⊗ P xE ⊗ P xF. - -(* esadecimali ricorsivi *) -ninductive rec_exadecim : exadecim → Type ≝ - ex_O : rec_exadecim x0 -| ex_S : ∀n.rec_exadecim n → rec_exadecim (succ_ex n). - -(* esadecimali → esadecimali ricorsivi *) -ndefinition ex_to_recex ≝ -λn.match n return λx.rec_exadecim x with - [ x0 ⇒ ex_O - | x1 ⇒ ex_S ? ex_O - | x2 ⇒ ex_S ? (ex_S ? ex_O) - | x3 ⇒ ex_S ? (ex_S ? (ex_S ? ex_O)) - | x4 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))) - | x5 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))) - | x6 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))))) - | x7 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))))) - | x8 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))))))) - | x9 ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))))))) - | xA ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))))))))) - | xB ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))))))))) - | xC ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))))))))))) - | xD ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))))))))))) - | xE ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O))))))))))))) - | xF ⇒ ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? (ex_S ? ex_O)))))))))))))) - ]. - -(* quaternari → esadecimali *) -ndefinition ex_of_qu ≝ -λn.match n with - [ q0 ⇒ x0 | q1 ⇒ x1 | q2 ⇒ x2 | q3 ⇒ x3 ]. - -(* ottali → esadecimali *) -ndefinition ex_of_oct ≝ -λn.match n with - [ o0 ⇒ x0 | o1 ⇒ x1 | o2 ⇒ x2 | o3 ⇒ x3 | o4 ⇒ x4 | o5 ⇒ x5 | o6 ⇒ x6 | o7 ⇒ x7 ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/exadecim_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/exadecim_lemmas.ma deleted file mode 100755 index c6e09d5ce..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/exadecim_lemmas.ma +++ /dev/null @@ -1,346 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/exadecim.ma". -include "num/bool_lemmas.ma". - -(* *********** *) -(* ESADECIMALI *) -(* *********** *) - -(* -ndefinition exadecim_destruct_aux ≝ -Πe1,e2.ΠP:Prop.ΠH:e1 = e2. - match eq_ex e1 e2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition exadecim_destruct : exadecim_destruct_aux. - #e1; #e2; #P; #H; - nrewrite < H; - nelim e1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma symmetric_andex : symmetricT exadecim exadecim and_ex. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_andex1 : ∀e2,e3.(and_ex (and_ex x0 e2) e3) = (and_ex x0 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex2 : ∀e2,e3.(and_ex (and_ex x1 e2) e3) = (and_ex x1 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex3 : ∀e2,e3.(and_ex (and_ex x2 e2) e3) = (and_ex x2 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex4 : ∀e2,e3.(and_ex (and_ex x3 e2) e3) = (and_ex x3 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex5 : ∀e2,e3.(and_ex (and_ex x4 e2) e3) = (and_ex x4 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex6 : ∀e2,e3.(and_ex (and_ex x5 e2) e3) = (and_ex x5 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex7 : ∀e2,e3.(and_ex (and_ex x6 e2) e3) = (and_ex x6 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex8 : ∀e2,e3.(and_ex (and_ex x7 e2) e3) = (and_ex x7 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex9 : ∀e2,e3.(and_ex (and_ex x8 e2) e3) = (and_ex x8 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex10 : ∀e2,e3.(and_ex (and_ex x9 e2) e3) = (and_ex x9 (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex11 : ∀e2,e3.(and_ex (and_ex xA e2) e3) = (and_ex xA (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex12 : ∀e2,e3.(and_ex (and_ex xB e2) e3) = (and_ex xB (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex13 : ∀e2,e3.(and_ex (and_ex xC e2) e3) = (and_ex xC (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex14 : ∀e2,e3.(and_ex (and_ex xD e2) e3) = (and_ex xD (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex15 : ∀e2,e3.(and_ex (and_ex xE e2) e3) = (and_ex xE (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_andex16 : ∀e2,e3.(and_ex (and_ex xF e2) e3) = (and_ex xF (and_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. - -nlemma associative_andex : ∀e1,e2,e3.(and_ex (and_ex e1 e2) e3) = (and_ex e1 (and_ex e2 e3)). - #e1; nelim e1; - ##[ ##1: napply associative_andex1 ##| ##2: napply associative_andex2 - ##| ##3: napply associative_andex3 ##| ##4: napply associative_andex4 - ##| ##5: napply associative_andex5 ##| ##6: napply associative_andex6 - ##| ##7: napply associative_andex7 ##| ##8: napply associative_andex8 - ##| ##9: napply associative_andex9 ##| ##10: napply associative_andex10 - ##| ##11: napply associative_andex11 ##| ##12: napply associative_andex12 - ##| ##13: napply associative_andex13 ##| ##14: napply associative_andex14 - ##| ##15: napply associative_andex15 ##| ##16: napply associative_andex16 - ##] -nqed. - -nlemma symmetric_orex : symmetricT exadecim exadecim or_ex. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_orex1 : ∀e2,e3.(or_ex (or_ex x0 e2) e3) = (or_ex x0 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex2 : ∀e2,e3.(or_ex (or_ex x1 e2) e3) = (or_ex x1 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex3 : ∀e2,e3.(or_ex (or_ex x2 e2) e3) = (or_ex x2 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex4 : ∀e2,e3.(or_ex (or_ex x3 e2) e3) = (or_ex x3 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex5 : ∀e2,e3.(or_ex (or_ex x4 e2) e3) = (or_ex x4 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex6 : ∀e2,e3.(or_ex (or_ex x5 e2) e3) = (or_ex x5 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex7 : ∀e2,e3.(or_ex (or_ex x6 e2) e3) = (or_ex x6 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex8 : ∀e2,e3.(or_ex (or_ex x7 e2) e3) = (or_ex x7 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex9 : ∀e2,e3.(or_ex (or_ex x8 e2) e3) = (or_ex x8 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex10 : ∀e2,e3.(or_ex (or_ex x9 e2) e3) = (or_ex x9 (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex11 : ∀e2,e3.(or_ex (or_ex xA e2) e3) = (or_ex xA (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex12 : ∀e2,e3.(or_ex (or_ex xB e2) e3) = (or_ex xB (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex13 : ∀e2,e3.(or_ex (or_ex xC e2) e3) = (or_ex xC (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex14 : ∀e2,e3.(or_ex (or_ex xD e2) e3) = (or_ex xD (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex15 : ∀e2,e3.(or_ex (or_ex xE e2) e3) = (or_ex xE (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_orex16 : ∀e2,e3.(or_ex (or_ex xF e2) e3) = (or_ex xF (or_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. - -nlemma associative_orex : ∀e1,e2,e3.(or_ex (or_ex e1 e2) e3) = (or_ex e1 (or_ex e2 e3)). - #e1; nelim e1; - ##[ ##1: napply associative_orex1 ##| ##2: napply associative_orex2 - ##| ##3: napply associative_orex3 ##| ##4: napply associative_orex4 - ##| ##5: napply associative_orex5 ##| ##6: napply associative_orex6 - ##| ##7: napply associative_orex7 ##| ##8: napply associative_orex8 - ##| ##9: napply associative_orex9 ##| ##10: napply associative_orex10 - ##| ##11: napply associative_orex11 ##| ##12: napply associative_orex12 - ##| ##13: napply associative_orex13 ##| ##14: napply associative_orex14 - ##| ##15: napply associative_orex15 ##| ##16: napply associative_orex16 - ##] -nqed. - -nlemma symmetric_xorex : symmetricT exadecim exadecim xor_ex. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_xorex1 : ∀e2,e3.(xor_ex (xor_ex x0 e2) e3) = (xor_ex x0 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex2 : ∀e2,e3.(xor_ex (xor_ex x1 e2) e3) = (xor_ex x1 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex3 : ∀e2,e3.(xor_ex (xor_ex x2 e2) e3) = (xor_ex x2 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex4 : ∀e2,e3.(xor_ex (xor_ex x3 e2) e3) = (xor_ex x3 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex5 : ∀e2,e3.(xor_ex (xor_ex x4 e2) e3) = (xor_ex x4 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex6 : ∀e2,e3.(xor_ex (xor_ex x5 e2) e3) = (xor_ex x5 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex7 : ∀e2,e3.(xor_ex (xor_ex x6 e2) e3) = (xor_ex x6 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex8 : ∀e2,e3.(xor_ex (xor_ex x7 e2) e3) = (xor_ex x7 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex9 : ∀e2,e3.(xor_ex (xor_ex x8 e2) e3) = (xor_ex x8 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex10 : ∀e2,e3.(xor_ex (xor_ex x9 e2) e3) = (xor_ex x9 (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex11 : ∀e2,e3.(xor_ex (xor_ex xA e2) e3) = (xor_ex xA (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex12 : ∀e2,e3.(xor_ex (xor_ex xB e2) e3) = (xor_ex xB (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex13 : ∀e2,e3.(xor_ex (xor_ex xC e2) e3) = (xor_ex xC (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex14 : ∀e2,e3.(xor_ex (xor_ex xD e2) e3) = (xor_ex xD (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex15 : ∀e2,e3.(xor_ex (xor_ex xE e2) e3) = (xor_ex xE (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_xorex16 : ∀e2,e3.(xor_ex (xor_ex xF e2) e3) = (xor_ex xF (xor_ex e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. - -nlemma associative_xorex : ∀e1,e2,e3.(xor_ex (xor_ex e1 e2) e3) = (xor_ex e1 (xor_ex e2 e3)). - #e1; nelim e1; - ##[ ##1: napply associative_xorex1 ##| ##2: napply associative_xorex2 - ##| ##3: napply associative_xorex3 ##| ##4: napply associative_xorex4 - ##| ##5: napply associative_xorex5 ##| ##6: napply associative_xorex6 - ##| ##7: napply associative_xorex7 ##| ##8: napply associative_xorex8 - ##| ##9: napply associative_xorex9 ##| ##10: napply associative_xorex10 - ##| ##11: napply associative_xorex11 ##| ##12: napply associative_xorex12 - ##| ##13: napply associative_xorex13 ##| ##14: napply associative_xorex14 - ##| ##15: napply associative_xorex15 ##| ##16: napply associative_xorex16 - ##] -nqed. - -nlemma symmetric_plusex_dc_dc : ∀e1,e2,c.plus_ex_dc_dc e1 e2 c = plus_ex_dc_dc e2 e1 c. - #e1; #e2; #c; - nelim e1; - nelim e2; - nelim c; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_dc_dc_to_dc_d : ∀e1,e2,c.fst … (plus_ex_dc_dc e1 e2 c) = plus_ex_dc_d e1 e2 c. - #e1; #e2; #c; - nelim e1; - nelim e2; - nelim c; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_dc_dc_to_dc_c : ∀e1,e2,c.snd … (plus_ex_dc_dc e1 e2 c) = plus_ex_dc_c e1 e2 c. - #e1; #e2; #c; - nelim e1; - nelim e2; - nelim c; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_dc_dc_to_d_dc : ∀e1,e2.plus_ex_dc_dc e1 e2 false = plus_ex_d_dc e1 e2. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_dc_dc_to_d_d : ∀e1,e2.fst … (plus_ex_dc_dc e1 e2 false) = plus_ex_d_d e1 e2. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_dc_dc_to_d_c : ∀e1,e2.snd … (plus_ex_dc_dc e1 e2 false) = plus_ex_d_c e1 e2. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_plusex_dc_d : ∀e1,e2,c.plus_ex_dc_d e1 e2 c = plus_ex_dc_d e2 e1 c. - #e1; #e2; #c; - nelim e1; - nelim e2; - nelim c; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_plusex_dc_c : ∀e1,e2,c.plus_ex_dc_c e1 e2 c = plus_ex_dc_c e2 e1 c. - #e1; #e2; #c; - nelim e1; - nelim e2; - nelim c; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_plusex_d_dc : ∀e1,e2.plus_ex_d_dc e1 e2 = plus_ex_d_dc e2 e1. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_d_dc_to_d_d : ∀e1,e2.fst … (plus_ex_d_dc e1 e2) = plus_ex_d_d e1 e2. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma plusex_d_dc_to_d_c : ∀e1,e2.snd … (plus_ex_d_dc e1 e2) = plus_ex_d_c e1 e2. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_plusex_d_d : ∀e1,e2.plus_ex_d_d e1 e2 = plus_ex_d_d e2 e1. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma associative_plusex_d_d1 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x0 e2) e3) = (plus_ex_d_d x0 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d2 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x1 e2) e3) = (plus_ex_d_d x1 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d3 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x2 e2) e3) = (plus_ex_d_d x2 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d4 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x3 e2) e3) = (plus_ex_d_d x3 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d5 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x4 e2) e3) = (plus_ex_d_d x4 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d6 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x5 e2) e3) = (plus_ex_d_d x5 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d7 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x6 e2) e3) = (plus_ex_d_d x6 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d8 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x7 e2) e3) = (plus_ex_d_d x7 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d9 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x8 e2) e3) = (plus_ex_d_d x8 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d10 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d x9 e2) e3) = (plus_ex_d_d x9 (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d11 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xA e2) e3) = (plus_ex_d_d xA (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d12 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xB e2) e3) = (plus_ex_d_d xB (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d13 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xC e2) e3) = (plus_ex_d_d xC (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d14 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xD e2) e3) = (plus_ex_d_d xD (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d15 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xE e2) e3) = (plus_ex_d_d xE (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. -nlemma associative_plusex_d_d16 : ∀e2,e3.(plus_ex_d_d (plus_ex_d_d xF e2) e3) = (plus_ex_d_d xF (plus_ex_d_d e2 e3)). #e2; #e3; nelim e2; nelim e3; nnormalize; napply refl_eq. nqed. - -nlemma associative_plusex_d_d : ∀e1,e2,e3.(plus_ex_d_d (plus_ex_d_d e1 e2) e3) = (plus_ex_d_d e1 (plus_ex_d_d e2 e3)). - #e1; nelim e1; - ##[ ##1: napply associative_plusex_d_d1 ##| ##2: napply associative_plusex_d_d2 - ##| ##3: napply associative_plusex_d_d3 ##| ##4: napply associative_plusex_d_d4 - ##| ##5: napply associative_plusex_d_d5 ##| ##6: napply associative_plusex_d_d6 - ##| ##7: napply associative_plusex_d_d7 ##| ##8: napply associative_plusex_d_d8 - ##| ##9: napply associative_plusex_d_d9 ##| ##10: napply associative_plusex_d_d10 - ##| ##11: napply associative_plusex_d_d11 ##| ##12: napply associative_plusex_d_d12 - ##| ##13: napply associative_plusex_d_d13 ##| ##14: napply associative_plusex_d_d14 - ##| ##15: napply associative_plusex_d_d15 ##| ##16: napply associative_plusex_d_d16 - ##] -nqed. - -nlemma symmetric_plusex_d_c : ∀e1,e2.plus_ex_d_c e1 e2 = plus_ex_d_c e2 e1. - #e1; #e2; - nelim e1; - nelim e2; - nnormalize; - napply refl_eq. -nqed. - -nlemma eq_to_eqex : ∀n1,n2.n1 = n2 → eq_ex n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqex_to_neq : ∀n1,n2.eq_ex n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_ex n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqex n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqex_to_eq : ∀n1,n2.eq_ex n1 n2 = true → n1 = n2. - #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,18,35,52,69,86,103,120,137,154,171,188,205,222,239,256: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma neq_to_neqex : ∀n1,n2.n1 ≠ n2 → eq_ex n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_ex n1 n2)); - napply (not_to_not (eq_ex n1 n2 = true) (n1 = n2) ? H); - napply (eqex_to_eq n1 n2). -nqed. - -nlemma decidable_ex : ∀x,y:exadecim.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_ex x y = true) (eq_ex x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqex_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqex_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqex : symmetricT exadecim bool eq_ex. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_ex n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqex n1 n2 H); - napply (symmetric_eq ? (eq_ex n2 n1) false); - napply (neq_to_neqex n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/oct.ma b/helm/software/matita/contribs/ng_assembly/num/oct.ma deleted file mode 100755 index fbdbacd5d..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/oct.ma +++ /dev/null @@ -1,78 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ****** *) -(* OTTALI *) -(* ****** *) - -ninductive oct : Type ≝ - o0: oct -| o1: oct -| o2: oct -| o3: oct -| o4: oct -| o5: oct -| o6: oct -| o7: oct. - -(* operatore = *) -ndefinition eq_oct ≝ -λn1,n2:oct. - match n1 with - [ o0 ⇒ match n2 with [ o0 ⇒ true | _ ⇒ false ] - | o1 ⇒ match n2 with [ o1 ⇒ true | _ ⇒ false ] - | o2 ⇒ match n2 with [ o2 ⇒ true | _ ⇒ false ] - | o3 ⇒ match n2 with [ o3 ⇒ true | _ ⇒ false ] - | o4 ⇒ match n2 with [ o4 ⇒ true | _ ⇒ false ] - | o5 ⇒ match n2 with [ o5 ⇒ true | _ ⇒ false ] - | o6 ⇒ match n2 with [ o6 ⇒ true | _ ⇒ false ] - | o7 ⇒ match n2 with [ o7 ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sugli ottali *) -ndefinition forall_oct ≝ λP. - P o0 ⊗ P o1 ⊗ P o2 ⊗ P o3 ⊗ P o4 ⊗ P o5 ⊗ P o6 ⊗ P o7. - -(* operatore successore *) -ndefinition succ_oct ≝ -λn.match n with - [ o0 ⇒ o1 | o1 ⇒ o2 | o2 ⇒ o3 | o3 ⇒ o4 | o4 ⇒ o5 | o5 ⇒ o6 | o6 ⇒ o7 | o7 ⇒ o0 ]. - -(* ottali ricorsivi *) -ninductive rec_oct : oct → Type ≝ - oc_O : rec_oct o0 -| oc_S : ∀n.rec_oct n → rec_oct (succ_oct n). - -(* ottali → ottali ricorsivi *) -ndefinition oct_to_recoct ≝ -λn.match n return λx.rec_oct x with - [ o0 ⇒ oc_O - | o1 ⇒ oc_S ? oc_O - | o2 ⇒ oc_S ? (oc_S ? oc_O) - | o3 ⇒ oc_S ? (oc_S ? (oc_S ? oc_O)) - | o4 ⇒ oc_S ? (oc_S ? (oc_S ? (oc_S ? oc_O))) - | o5 ⇒ oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? oc_O)))) - | o6 ⇒ oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? oc_O))))) - | o7 ⇒ oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? (oc_S ? oc_O)))))) - ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma deleted file mode 100755 index 3a29cc1b7..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/oct_lemmas.ma +++ /dev/null @@ -1,93 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/oct.ma". -include "num/bool_lemmas.ma". - -(* ****** *) -(* OTTALI *) -(* ****** *) - -(* -ndefinition oct_destruct_aux ≝ -Πn1,n2:oct.ΠP:Prop.n1 = n2 → - match eq_oct n1 n2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition oct_destruct : oct_destruct_aux. - #n1; #n2; #P; #H; - nrewrite < H; - nelim n1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma eq_to_eqoct : ∀n1,n2.n1 = n2 → eq_oct n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqoct_to_neq : ∀n1,n2.eq_oct n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_oct n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqoct n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqoct_to_eq : ∀n1,n2.eq_oct n1 n2 = true → n1 = n2. - #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,10,19,28,37,46,55,64: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma neq_to_neqoct : ∀n1,n2.n1 ≠ n2 → eq_oct n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_oct n1 n2)); - napply (not_to_not (eq_oct n1 n2 = true) (n1 = n2) ? H); - napply (eqoct_to_eq n1 n2). -nqed. - -nlemma decidable_oct : ∀x,y:oct.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_oct x y = true) (eq_oct x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqoct_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqoct_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqoct : symmetricT oct bool eq_oct. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_oct n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqoct n1 n2 H); - napply (symmetric_eq ? (eq_oct n2 n1) false); - napply (neq_to_neqoct n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/quatern.ma b/helm/software/matita/contribs/ng_assembly/num/quatern.ma deleted file mode 100755 index a6bc1343f..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/quatern.ma +++ /dev/null @@ -1,66 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/bool.ma". - -(* ********** *) -(* QUATERNARI *) -(* ********** *) - -ninductive quatern : Type ≝ - q0 : quatern -| q1 : quatern -| q2 : quatern -| q3 : quatern. - -(* operatore = *) -ndefinition eq_qu ≝ -λn1,n2:quatern. - match n1 with - [ q0 ⇒ match n2 with [ q0 ⇒ true | _ ⇒ false ] - | q1 ⇒ match n2 with [ q1 ⇒ true | _ ⇒ false ] - | q2 ⇒ match n2 with [ q2 ⇒ true | _ ⇒ false ] - | q3 ⇒ match n2 with [ q3 ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sui quaternari *) -ndefinition forall_qu ≝ λP. - P q0 ⊗ P q1 ⊗ P q2 ⊗ P q3. - -(* operatore successorre *) -ndefinition succ_qu ≝ -λn.match n with - [ q0 ⇒ q1 | q1 ⇒ q2 | q2 ⇒ q3 | q3 ⇒ q0 ]. - -(* quaternari ricorsivi *) -ninductive rec_quatern : quatern → Type ≝ - qu_O : rec_quatern q0 -| qu_S : ∀n.rec_quatern n → rec_quatern (succ_qu n). - -(* quaternari → quaternari ricorsivi *) -ndefinition qu_to_recqu ≝ -λn.match n return λx.rec_quatern x with - [ q0 ⇒ qu_O - | q1 ⇒ qu_S ? qu_O - | q2 ⇒ qu_S ? (qu_S ? qu_O) - | q3 ⇒ qu_S ? (qu_S ? (qu_S ? qu_O)) - ]. diff --git a/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma deleted file mode 100755 index a3ff94559..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/quatern_lemmas.ma +++ /dev/null @@ -1,93 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/quatern.ma". -include "num/bool_lemmas.ma". - -(* ********** *) -(* QUATERNARI *) -(* ********** *) - -(* -ndefinition quatern_destruct_aux ≝ -Πn1,n2:quatern.ΠP:Prop.n1 = n2 → - match eq_qu n1 n2 with [ true ⇒ P → P | false ⇒ P ]. - -ndefinition quatern_destruct : quatern_destruct_aux. - #n1; #n2; #P; #H; - nrewrite < H; - nelim n1; - nnormalize; - napply (λx.x). -nqed. -*) - -nlemma eq_to_eqqu : ∀n1,n2.n1 = n2 → eq_qu n1 n2 = true. - #n1; #n2; #H; - nrewrite > H; - nelim n2; - nnormalize; - napply refl_eq. -nqed. - -nlemma neqqu_to_neq : ∀n1,n2.eq_qu n1 n2 = false → n1 ≠ n2. - #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_qu n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqqu n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -nlemma eqqu_to_eq : ∀n1,n2.eq_qu n1 n2 = true → n1 = n2. - #n1; #n2; - ncases n1; - ncases n2; - nnormalize; - ##[ ##1,6,11,16: #H; napply refl_eq - ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) - ##] -nqed. - -nlemma neq_to_neqqu : ∀n1,n2.n1 ≠ n2 → eq_qu n1 n2 = false. - #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_qu n1 n2)); - napply (not_to_not (eq_qu n1 n2 = true) (n1 = n2) ? H); - napply (eqqu_to_eq n1 n2). -nqed. - -nlemma decidable_qu : ∀x,y:quatern.decidable (x = y). - #x; #y; nnormalize; - napply (or2_elim (eq_qu x y = true) (eq_qu x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqqu_to_eq … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqqu_to_neq … H)) - ##] -nqed. - -nlemma symmetric_eqqu : symmetricT quatern bool eq_qu. - #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_qu n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqqu n1 n2 H); - napply (symmetric_eq ? (eq_qu n2 n1) false); - napply (neq_to_neqqu n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/word16.ma b/helm/software/matita/contribs/ng_assembly/num/word16.ma deleted file mode 100755 index e89e64f3d..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/word16.ma +++ /dev/null @@ -1,763 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/byte8.ma". - -(* **** *) -(* WORD *) -(* **** *) - -nrecord word16 : Type ≝ - { - w16h: byte8; - w16l: byte8 - }. - -(* \langle \rangle *) -notation "〈x:y〉" non associative with precedence 80 - for @{ 'mk_word16 $x $y }. -interpretation "mk_word16" 'mk_word16 x y = (mk_word16 x y). - -(* operatore = *) -ndefinition eq_w16 ≝ λw1,w2.(eq_b8 (w16h w1) (w16h w2)) ⊗ (eq_b8 (w16l w1) (w16l w2)). - -(* operatore < *) -ndefinition lt_w16 ≝ -λw1,w2:word16. - (lt_b8 (w16h w1) (w16h w2)) ⊕ - ((eq_b8 (w16h w1) (w16h w2)) ⊗ (lt_b8 (w16l w1) (w16l w2))). - -(* operatore ≤ *) -ndefinition le_w16 ≝ -λw1,w2:word16. - (lt_b8 (w16h w1) (w16h w2)) ⊕ - ((eq_b8 (w16h w1) (w16h w2)) ⊗ (le_b8 (w16l w1) (w16l w2))). - -(* operatore > *) -ndefinition gt_w16 ≝ -λw1,w2:word16. - (gt_b8 (w16h w1) (w16h w2)) ⊕ - ((eq_b8 (w16h w1) (w16h w2)) ⊗ (gt_b8 (w16l w1) (w16l w2))). - -(* operatore ≥ *) -ndefinition ge_w16 ≝ -λw1,w2:word16. - (gt_b8 (w16h w1) (w16h w2)) ⊕ - ((eq_b8 (w16h w1) (w16h w2)) ⊗ (ge_b8 (w16l w1) (w16l w2))). - -(* operatore and *) -ndefinition and_w16 ≝ -λw1,w2:word16.mk_word16 (and_b8 (w16h w1) (w16h w2)) (and_b8 (w16l w1) (w16l w2)). - -(* operatore or *) -ndefinition or_w16 ≝ -λw1,w2:word16.mk_word16 (or_b8 (w16h w1) (w16h w2)) (or_b8 (w16l w1) (w16l w2)). - -(* operatore xor *) -ndefinition xor_w16 ≝ -λw1,w2:word16.mk_word16 (xor_b8 (w16h w1) (w16h w2)) (xor_b8 (w16l w1) (w16l w2)). - -(* operatore rotazione destra con carry *) -ndefinition rcr_w16 ≝ -λw:word16.λc:bool.match rcr_b8 (w16h w) c with - [ pair wh' c' ⇒ match rcr_b8 (w16l w) c' with - [ pair wl' c'' ⇒ pair … (mk_word16 wh' wl') c'' ]]. - -(* operatore shift destro *) -ndefinition shr_w16 ≝ -λw:word16.match rcr_b8 (w16h w) false with - [ pair wh' c' ⇒ match rcr_b8 (w16l w) c' with - [ pair wl' c'' ⇒ pair … (mk_word16 wh' wl') c'' ]]. - -(* operatore rotazione destra *) -ndefinition ror_w16 ≝ -λw:word16.match rcr_b8 (w16h w) false with - [ pair wh' c' ⇒ match rcr_b8 (w16l w) c' with - [ pair wl' c'' ⇒ match c'' with - [ true ⇒ mk_word16 (or_b8 (mk_byte8 x8 x0) wh') wl' - | false ⇒ mk_word16 wh' wl' ]]]. - -(* operatore rotazione destra n-volte *) -nlet rec ror_w16_n (w:word16) (n:nat) on n ≝ - match n with - [ O ⇒ w - | S n' ⇒ ror_w16_n (ror_w16 w) n' ]. - -(* operatore rotazione sinistra con carry *) -ndefinition rcl_w16 ≝ -λw:word16.λc:bool.match rcl_b8 (w16l w) c with - [ pair wl' c' ⇒ match rcl_b8 (w16h w) c' with - [ pair wh' c'' ⇒ pair … (mk_word16 wh' wl') c'' ]]. - -(* operatore shift sinistro *) -ndefinition shl_w16 ≝ -λw:word16.match rcl_b8 (w16l w) false with - [ pair wl' c' ⇒ match rcl_b8 (w16h w) c' with - [ pair wh' c'' ⇒ pair … (mk_word16 wh' wl') c'' ]]. - -(* operatore rotazione sinistra *) -ndefinition rol_w16 ≝ -λw:word16.match rcl_b8 (w16l w) false with - [ pair wl' c' ⇒ match rcl_b8 (w16h w) c' with - [ pair wh' c'' ⇒ match c'' with - [ true ⇒ mk_word16 wh' (or_b8 (mk_byte8 x0 x1) wl') - | false ⇒ mk_word16 wh' wl' ]]]. - -(* operatore rotazione sinistra n-volte *) -nlet rec rol_w16_n (w:word16) (n:nat) on n ≝ - match n with - [ O ⇒ w - | S n' ⇒ rol_w16_n (rol_w16 w) n' ]. - -(* operatore not/complemento a 1 *) -ndefinition not_w16 ≝ -λw:word16.mk_word16 (not_b8 (w16h w)) (not_b8 (w16l w)). - -(* operatore somma con data+carry → data+carry *) -ndefinition plus_w16_dc_dc ≝ -λw1,w2:word16.λc:bool. - match plus_b8_dc_dc (w16l w1) (w16l w2) c with - [ pair l c ⇒ match plus_b8_dc_dc (w16h w1) (w16h w2) c with - [ pair h c' ⇒ pair … 〈h:l〉 c' ]]. - -(* operatore somma con data+carry → data *) -ndefinition plus_w16_dc_d ≝ -λw1,w2:word16.λc:bool. - match plus_b8_dc_dc (w16l w1) (w16l w2) c with - [ pair l c ⇒ 〈plus_b8_dc_d (w16h w1) (w16h w2) c:l〉 ]. - -(* operatore somma con data+carry → c *) -ndefinition plus_w16_dc_c ≝ -λw1,w2:word16.λc:bool. - plus_b8_dc_c (w16h w1) (w16h w2) (plus_b8_dc_c (w16l w1) (w16l w2) c). - -(* operatore somma con data → data+carry *) -ndefinition plus_w16_d_dc ≝ -λw1,w2:word16. - match plus_b8_d_dc (w16l w1) (w16l w2) with - [ pair l c ⇒ match plus_b8_dc_dc (w16h w1) (w16h w2) c with - [ pair h c' ⇒ pair … 〈h:l〉 c' ]]. - -(* operatore somma con data → data *) -ndefinition plus_w16_d_d ≝ -λw1,w2:word16. - match plus_b8_d_dc (w16l w1) (w16l w2) with - [ pair l c ⇒ 〈plus_b8_dc_d (w16h w1) (w16h w2) c:l〉 ]. - -(* operatore somma con data → c *) -ndefinition plus_w16_d_c ≝ -λw1,w2:word16. - plus_b8_dc_c (w16h w1) (w16h w2) (plus_b8_d_c (w16l w1) (w16l w2)). - -(* operatore Most Significant Bit *) -ndefinition MSB_w16 ≝ λw:word16.eq_ex x8 (and_ex x8 (b8h (w16h w))). - -(* operatore predecessore *) -ndefinition pred_w16 ≝ -λw:word16.match eq_b8 (w16l w) (mk_byte8 x0 x0) with - [ true ⇒ mk_word16 (pred_b8 (w16h w)) (pred_b8 (w16l w)) - | false ⇒ mk_word16 (w16h w) (pred_b8 (w16l w)) ]. - -(* operatore successore *) -ndefinition succ_w16 ≝ -λw:word16.match eq_b8 (w16l w) (mk_byte8 xF xF) with - [ true ⇒ mk_word16 (succ_b8 (w16h w)) (succ_b8 (w16l w)) - | false ⇒ mk_word16 (w16h w) (succ_b8 (w16l w)) ]. - -(* operatore neg/complemento a 2 *) -ndefinition compl_w16 ≝ -λw:word16.match MSB_w16 w with - [ true ⇒ succ_w16 (not_w16 w) - | false ⇒ not_w16 (pred_w16 w) ]. - -(* - operatore moltiplicazione senza segno: b*b=[0x0000,0xFE01] - ... in pratica (〈a,b〉*〈c,d〉) = (a*c)<<8+(a*d)<<4+(b*c)<<4+(b*d) -*) -ndefinition mul_b8 ≝ -λb1,b2:byte8.match b1 with -[ mk_byte8 b1h b1l ⇒ match b2 with -[ mk_byte8 b2h b2l ⇒ match mul_ex b1l b2l with -[ mk_byte8 t1_h t1_l ⇒ match mul_ex b1h b2l with -[ mk_byte8 t2_h t2_l ⇒ match mul_ex b2h b1l with -[ mk_byte8 t3_h t3_l ⇒ match mul_ex b1h b2h with -[ mk_byte8 t4_h t4_l ⇒ - plus_w16_d_d - (plus_w16_d_d - (plus_w16_d_d 〈〈x0,t3_h〉:〈t3_l,x0〉〉 〈〈x0,t2_h〉:〈t2_l,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈t1_h,t1_l〉〉 -]]]]]]. - -(* divisione senza segno (secondo la logica delle ALU): (quoziente resto) overflow *) -nlet rec div_b8_aux (divd:word16) (divs:word16) (molt:byte8) (q:byte8) (c:nat) on c ≝ - let w' ≝ plus_w16_d_d divd (compl_w16 divs) in - match c with - [ O ⇒ match le_w16 divs divd with - [ true ⇒ triple … (or_b8 molt q) (w16l w') (⊖ (eq_b8 (w16h w') 〈x0,x0〉)) - | false ⇒ triple … q (w16l divd) (⊖ (eq_b8 (w16h divd) 〈x0,x0〉)) ] - | S c' ⇒ match le_w16 divs divd with - [ true ⇒ div_b8_aux w' (ror_w16 divs) (ror_b8 molt) (or_b8 molt q) c' - | false ⇒ div_b8_aux divd (ror_w16 divs) (ror_b8 molt) q c' ]]. - -ndefinition div_b8 ≝ -λw:word16.λb:byte8.match eq_b8 b 〈x0,x0〉 with -(* - la combinazione n/0 e' illegale, segnala solo overflow senza dare risultato -*) - [ true ⇒ triple … 〈xF,xF〉 (w16l w) true - | false ⇒ match eq_w16 w 〈〈x0,x0〉:〈x0,x0〉〉 with -(* 0 diviso qualsiasi cosa diverso da 0 da' q=0 r=0 o=false *) - [ true ⇒ triple … 〈x0,x0〉 〈x0,x0〉 false -(* 1) e' una divisione sensata che produrra' overflow/risultato *) -(* 2) parametri: dividendo, divisore, moltiplicatore, quoziente, contatore *) -(* 3) ad ogni ciclo il divisore e il moltiplicatore vengono scalati di 1 a dx *) -(* 4) il moltiplicatore e' la quantita' aggiunta al quoziente se il divisore *) -(* puo' essere sottratto al dividendo *) - | false ⇒ div_b8_aux w (rol_w16_n 〈〈x0,x0〉:b〉 nat7) 〈x8,x0〉 〈x0,x0〉 nat7 ]]. - -(* operatore x in [inf,sup] o in sup],[inf *) -ndefinition inrange_w16 ≝ -λx,inf,sup:word16. - match le_w16 inf sup with - [ true ⇒ and_bool | false ⇒ or_bool ] - (le_w16 inf x) (le_w16 x sup). - -(* iteratore sulle word *) -ndefinition forall_w16 ≝ - λP. - forall_b8 (λbh. - forall_b8 (λbl. - P (mk_word16 bh bl ))). - -(* word16 ricorsive *) -ninductive rec_word16 : word16 → Type ≝ - w16_O : rec_word16 〈〈x0,x0〉:〈x0,x0〉〉 -| w16_S : ∀n.rec_word16 n → rec_word16 (succ_w16 n). - -(* word16 → word16 ricorsive *) - -(* EX: ancora problema di tempi ??? -ndefinition w16_to_recw16_aux1_1 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x1,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? ( - w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? (w16_S ? recw - ))))))))))))))). -*) - -ndefinition w16_to_recw16_aux1_1 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x1,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x0,xF〉〉 (w16_S 〈n:〈x0,xE〉〉 (w16_S 〈n:〈x0,xD〉〉 (w16_S 〈n:〈x0,xC〉〉 ( - w16_S 〈n:〈x0,xB〉〉 (w16_S 〈n:〈x0,xA〉〉 (w16_S 〈n:〈x0,x9〉〉 (w16_S 〈n:〈x0,x8〉〉 ( - w16_S 〈n:〈x0,x7〉〉 (w16_S 〈n:〈x0,x6〉〉 (w16_S 〈n:〈x0,x5〉〉 (w16_S 〈n:〈x0,x4〉〉 ( - w16_S 〈n:〈x0,x3〉〉 (w16_S 〈n:〈x0,x2〉〉 (w16_S 〈n:〈x0,x1〉〉 (w16_S 〈n:〈x0,x0〉〉 recw - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_2 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x2,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x1,xF〉〉 (w16_S 〈n:〈x1,xE〉〉 (w16_S 〈n:〈x1,xD〉〉 (w16_S 〈n:〈x1,xC〉〉 ( - w16_S 〈n:〈x1,xB〉〉 (w16_S 〈n:〈x1,xA〉〉 (w16_S 〈n:〈x1,x9〉〉 (w16_S 〈n:〈x1,x8〉〉 ( - w16_S 〈n:〈x1,x7〉〉 (w16_S 〈n:〈x1,x6〉〉 (w16_S 〈n:〈x1,x5〉〉 (w16_S 〈n:〈x1,x4〉〉 ( - w16_S 〈n:〈x1,x3〉〉 (w16_S 〈n:〈x1,x2〉〉 (w16_S 〈n:〈x1,x1〉〉 (w16_S 〈n:〈x1,x0〉〉 (w16_to_recw16_aux1_1 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_3 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x3,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x2,xF〉〉 (w16_S 〈n:〈x2,xE〉〉 (w16_S 〈n:〈x2,xD〉〉 (w16_S 〈n:〈x2,xC〉〉 ( - w16_S 〈n:〈x2,xB〉〉 (w16_S 〈n:〈x2,xA〉〉 (w16_S 〈n:〈x2,x9〉〉 (w16_S 〈n:〈x2,x8〉〉 ( - w16_S 〈n:〈x2,x7〉〉 (w16_S 〈n:〈x2,x6〉〉 (w16_S 〈n:〈x2,x5〉〉 (w16_S 〈n:〈x2,x4〉〉 ( - w16_S 〈n:〈x2,x3〉〉 (w16_S 〈n:〈x2,x2〉〉 (w16_S 〈n:〈x2,x1〉〉 (w16_S 〈n:〈x2,x0〉〉 (w16_to_recw16_aux1_2 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_4 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x4,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x3,xF〉〉 (w16_S 〈n:〈x3,xE〉〉 (w16_S 〈n:〈x3,xD〉〉 (w16_S 〈n:〈x3,xC〉〉 ( - w16_S 〈n:〈x3,xB〉〉 (w16_S 〈n:〈x3,xA〉〉 (w16_S 〈n:〈x3,x9〉〉 (w16_S 〈n:〈x3,x8〉〉 ( - w16_S 〈n:〈x3,x7〉〉 (w16_S 〈n:〈x3,x6〉〉 (w16_S 〈n:〈x3,x5〉〉 (w16_S 〈n:〈x3,x4〉〉 ( - w16_S 〈n:〈x3,x3〉〉 (w16_S 〈n:〈x3,x2〉〉 (w16_S 〈n:〈x3,x1〉〉 (w16_S 〈n:〈x3,x0〉〉 (w16_to_recw16_aux1_3 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_5 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x5,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x4,xF〉〉 (w16_S 〈n:〈x4,xE〉〉 (w16_S 〈n:〈x4,xD〉〉 (w16_S 〈n:〈x4,xC〉〉 ( - w16_S 〈n:〈x4,xB〉〉 (w16_S 〈n:〈x4,xA〉〉 (w16_S 〈n:〈x4,x9〉〉 (w16_S 〈n:〈x4,x8〉〉 ( - w16_S 〈n:〈x4,x7〉〉 (w16_S 〈n:〈x4,x6〉〉 (w16_S 〈n:〈x4,x5〉〉 (w16_S 〈n:〈x4,x4〉〉 ( - w16_S 〈n:〈x4,x3〉〉 (w16_S 〈n:〈x4,x2〉〉 (w16_S 〈n:〈x4,x1〉〉 (w16_S 〈n:〈x4,x0〉〉 (w16_to_recw16_aux1_4 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_6 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x6,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x5,xF〉〉 (w16_S 〈n:〈x5,xE〉〉 (w16_S 〈n:〈x5,xD〉〉 (w16_S 〈n:〈x5,xC〉〉 ( - w16_S 〈n:〈x5,xB〉〉 (w16_S 〈n:〈x5,xA〉〉 (w16_S 〈n:〈x5,x9〉〉 (w16_S 〈n:〈x5,x8〉〉 ( - w16_S 〈n:〈x5,x7〉〉 (w16_S 〈n:〈x5,x6〉〉 (w16_S 〈n:〈x5,x5〉〉 (w16_S 〈n:〈x5,x4〉〉 ( - w16_S 〈n:〈x5,x3〉〉 (w16_S 〈n:〈x5,x2〉〉 (w16_S 〈n:〈x5,x1〉〉 (w16_S 〈n:〈x5,x0〉〉 (w16_to_recw16_aux1_5 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_7 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x7,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x6,xF〉〉 (w16_S 〈n:〈x6,xE〉〉 (w16_S 〈n:〈x6,xD〉〉 (w16_S 〈n:〈x6,xC〉〉 ( - w16_S 〈n:〈x6,xB〉〉 (w16_S 〈n:〈x6,xA〉〉 (w16_S 〈n:〈x6,x9〉〉 (w16_S 〈n:〈x6,x8〉〉 ( - w16_S 〈n:〈x6,x7〉〉 (w16_S 〈n:〈x6,x6〉〉 (w16_S 〈n:〈x6,x5〉〉 (w16_S 〈n:〈x6,x4〉〉 ( - w16_S 〈n:〈x6,x3〉〉 (w16_S 〈n:〈x6,x2〉〉 (w16_S 〈n:〈x6,x1〉〉 (w16_S 〈n:〈x6,x0〉〉 (w16_to_recw16_aux1_6 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_8 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x8,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x7,xF〉〉 (w16_S 〈n:〈x7,xE〉〉 (w16_S 〈n:〈x7,xD〉〉 (w16_S 〈n:〈x7,xC〉〉 ( - w16_S 〈n:〈x7,xB〉〉 (w16_S 〈n:〈x7,xA〉〉 (w16_S 〈n:〈x7,x9〉〉 (w16_S 〈n:〈x7,x8〉〉 ( - w16_S 〈n:〈x7,x7〉〉 (w16_S 〈n:〈x7,x6〉〉 (w16_S 〈n:〈x7,x5〉〉 (w16_S 〈n:〈x7,x4〉〉 ( - w16_S 〈n:〈x7,x3〉〉 (w16_S 〈n:〈x7,x2〉〉 (w16_S 〈n:〈x7,x1〉〉 (w16_S 〈n:〈x7,x0〉〉 (w16_to_recw16_aux1_7 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_9 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈x9,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x8,xF〉〉 (w16_S 〈n:〈x8,xE〉〉 (w16_S 〈n:〈x8,xD〉〉 (w16_S 〈n:〈x8,xC〉〉 ( - w16_S 〈n:〈x8,xB〉〉 (w16_S 〈n:〈x8,xA〉〉 (w16_S 〈n:〈x8,x9〉〉 (w16_S 〈n:〈x8,x8〉〉 ( - w16_S 〈n:〈x8,x7〉〉 (w16_S 〈n:〈x8,x6〉〉 (w16_S 〈n:〈x8,x5〉〉 (w16_S 〈n:〈x8,x4〉〉 ( - w16_S 〈n:〈x8,x3〉〉 (w16_S 〈n:〈x8,x2〉〉 (w16_S 〈n:〈x8,x1〉〉 (w16_S 〈n:〈x8,x0〉〉 (w16_to_recw16_aux1_8 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_10 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xA,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈x9,xF〉〉 (w16_S 〈n:〈x9,xE〉〉 (w16_S 〈n:〈x9,xD〉〉 (w16_S 〈n:〈x9,xC〉〉 ( - w16_S 〈n:〈x9,xB〉〉 (w16_S 〈n:〈x9,xA〉〉 (w16_S 〈n:〈x9,x9〉〉 (w16_S 〈n:〈x9,x8〉〉 ( - w16_S 〈n:〈x9,x7〉〉 (w16_S 〈n:〈x9,x6〉〉 (w16_S 〈n:〈x9,x5〉〉 (w16_S 〈n:〈x9,x4〉〉 ( - w16_S 〈n:〈x9,x3〉〉 (w16_S 〈n:〈x9,x2〉〉 (w16_S 〈n:〈x9,x1〉〉 (w16_S 〈n:〈x9,x0〉〉 (w16_to_recw16_aux1_9 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_11 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xB,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xA,xF〉〉 (w16_S 〈n:〈xA,xE〉〉 (w16_S 〈n:〈xA,xD〉〉 (w16_S 〈n:〈xA,xC〉〉 ( - w16_S 〈n:〈xA,xB〉〉 (w16_S 〈n:〈xA,xA〉〉 (w16_S 〈n:〈xA,x9〉〉 (w16_S 〈n:〈xA,x8〉〉 ( - w16_S 〈n:〈xA,x7〉〉 (w16_S 〈n:〈xA,x6〉〉 (w16_S 〈n:〈xA,x5〉〉 (w16_S 〈n:〈xA,x4〉〉 ( - w16_S 〈n:〈xA,x3〉〉 (w16_S 〈n:〈xA,x2〉〉 (w16_S 〈n:〈xA,x1〉〉 (w16_S 〈n:〈xA,x0〉〉 (w16_to_recw16_aux1_10 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_12 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xC,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xB,xF〉〉 (w16_S 〈n:〈xB,xE〉〉 (w16_S 〈n:〈xB,xD〉〉 (w16_S 〈n:〈xB,xC〉〉 ( - w16_S 〈n:〈xB,xB〉〉 (w16_S 〈n:〈xB,xA〉〉 (w16_S 〈n:〈xB,x9〉〉 (w16_S 〈n:〈xB,x8〉〉 ( - w16_S 〈n:〈xB,x7〉〉 (w16_S 〈n:〈xB,x6〉〉 (w16_S 〈n:〈xB,x5〉〉 (w16_S 〈n:〈xB,x4〉〉 ( - w16_S 〈n:〈xB,x3〉〉 (w16_S 〈n:〈xB,x2〉〉 (w16_S 〈n:〈xB,x1〉〉 (w16_S 〈n:〈xB,x0〉〉 (w16_to_recw16_aux1_11 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_13 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xD,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xC,xF〉〉 (w16_S 〈n:〈xC,xE〉〉 (w16_S 〈n:〈xC,xD〉〉 (w16_S 〈n:〈xC,xC〉〉 ( - w16_S 〈n:〈xC,xB〉〉 (w16_S 〈n:〈xC,xA〉〉 (w16_S 〈n:〈xC,x9〉〉 (w16_S 〈n:〈xC,x8〉〉 ( - w16_S 〈n:〈xC,x7〉〉 (w16_S 〈n:〈xC,x6〉〉 (w16_S 〈n:〈xC,x5〉〉 (w16_S 〈n:〈xC,x4〉〉 ( - w16_S 〈n:〈xC,x3〉〉 (w16_S 〈n:〈xC,x2〉〉 (w16_S 〈n:〈xC,x1〉〉 (w16_S 〈n:〈xC,x0〉〉 (w16_to_recw16_aux1_12 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_14 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xE,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xD,xF〉〉 (w16_S 〈n:〈xD,xE〉〉 (w16_S 〈n:〈xD,xD〉〉 (w16_S 〈n:〈xD,xC〉〉 ( - w16_S 〈n:〈xD,xB〉〉 (w16_S 〈n:〈xD,xA〉〉 (w16_S 〈n:〈xD,x9〉〉 (w16_S 〈n:〈xD,x8〉〉 ( - w16_S 〈n:〈xD,x7〉〉 (w16_S 〈n:〈xD,x6〉〉 (w16_S 〈n:〈xD,x5〉〉 (w16_S 〈n:〈xD,x4〉〉 ( - w16_S 〈n:〈xD,x3〉〉 (w16_S 〈n:〈xD,x2〉〉 (w16_S 〈n:〈xD,x1〉〉 (w16_S 〈n:〈xD,x0〉〉 (w16_to_recw16_aux1_13 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1_15 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈n:〈xF,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xE,xF〉〉 (w16_S 〈n:〈xE,xE〉〉 (w16_S 〈n:〈xE,xD〉〉 (w16_S 〈n:〈xE,xC〉〉 ( - w16_S 〈n:〈xE,xB〉〉 (w16_S 〈n:〈xE,xA〉〉 (w16_S 〈n:〈xE,x9〉〉 (w16_S 〈n:〈xE,x8〉〉 ( - w16_S 〈n:〈xE,x7〉〉 (w16_S 〈n:〈xE,x6〉〉 (w16_S 〈n:〈xE,x5〉〉 (w16_S 〈n:〈xE,x4〉〉 ( - w16_S 〈n:〈xE,x3〉〉 (w16_S 〈n:〈xE,x2〉〉 (w16_S 〈n:〈xE,x1〉〉 (w16_S 〈n:〈xE,x0〉〉 (w16_to_recw16_aux1_14 ? recw) - ))))))))))))))). - -ndefinition w16_to_recw16_aux1 : Πn.rec_word16 〈n:〈x0,x0〉〉 → rec_word16 〈(succ_b8 n):〈x0,x0〉〉 ≝ -λn.λrecw:rec_word16 〈n:〈x0,x0〉〉. - w16_S 〈n:〈xF,xF〉〉 (w16_S 〈n:〈xF,xE〉〉 (w16_S 〈n:〈xF,xD〉〉 (w16_S 〈n:〈xF,xC〉〉 ( - w16_S 〈n:〈xF,xB〉〉 (w16_S 〈n:〈xF,xA〉〉 (w16_S 〈n:〈xF,x9〉〉 (w16_S 〈n:〈xF,x8〉〉 ( - w16_S 〈n:〈xF,x7〉〉 (w16_S 〈n:〈xF,x6〉〉 (w16_S 〈n:〈xF,x5〉〉 (w16_S 〈n:〈xF,x4〉〉 ( - w16_S 〈n:〈xF,x3〉〉 (w16_S 〈n:〈xF,x2〉〉 (w16_S 〈n:〈xF,x1〉〉 (w16_S 〈n:〈xF,x0〉〉 (w16_to_recw16_aux1_15 ? recw) - ))))))))))))))). - -(* ... cifra byte superiore *) -nlet rec w16_to_recw16_aux2 (n:byte8) (r:rec_byte8 n) on r ≝ - match r return λx.λy:rec_byte8 x.rec_word16 〈x:〈x0,x0〉〉 with - [ b8_O ⇒ w16_O - | b8_S t n' ⇒ w16_to_recw16_aux1 ? (w16_to_recw16_aux2 t n') - ]. - -(* ... cifra esadecimale n.2 *) -ndefinition w16_to_recw16_aux3 ≝ -λb,n.λrecw:rec_word16 〈b:〈x0,x0〉〉. - match n return λx.rec_word16 〈b:〈x,x0〉〉 with - [ x0 ⇒ recw - | x1 ⇒ w16_to_recw16_aux1_1 ? recw - | x2 ⇒ w16_to_recw16_aux1_2 ? recw - | x3 ⇒ w16_to_recw16_aux1_3 ? recw - | x4 ⇒ w16_to_recw16_aux1_4 ? recw - | x5 ⇒ w16_to_recw16_aux1_5 ? recw - | x6 ⇒ w16_to_recw16_aux1_6 ? recw - | x7 ⇒ w16_to_recw16_aux1_7 ? recw - | x8 ⇒ w16_to_recw16_aux1_8 ? recw - | x9 ⇒ w16_to_recw16_aux1_9 ? recw - | xA ⇒ w16_to_recw16_aux1_10 ? recw - | xB ⇒ w16_to_recw16_aux1_11 ? recw - | xC ⇒ w16_to_recw16_aux1_12 ? recw - | xD ⇒ w16_to_recw16_aux1_13 ? recw - | xE ⇒ w16_to_recw16_aux1_14 ? recw - | xF ⇒ w16_to_recw16_aux1_15 ? recw - ]. - -ndefinition w16_to_recw16_aux4_1 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x1〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x1〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? recw - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? recw - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? recw - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? recw - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? recw - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? recw - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? recw - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? recw - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? recw - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? recw - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? recw - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? recw - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? recw - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? recw - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? recw - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? recw - ]. - -ndefinition w16_to_recw16_aux4_2 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x2〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x2〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_1 … recw) - ]. - -ndefinition w16_to_recw16_aux4_3 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x3〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x3〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_2 … recw) - ]. - -ndefinition w16_to_recw16_aux4_4 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x4〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x4〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_3 … recw) - ]. - -ndefinition w16_to_recw16_aux4_5 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x5〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x5〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_4 … recw) - ]. - -ndefinition w16_to_recw16_aux4_6 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x6〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x6〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_5 … recw) - ]. - -ndefinition w16_to_recw16_aux4_7 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x7〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x7〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_6 … recw) - ]. - -ndefinition w16_to_recw16_aux4_8 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x8〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x8〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_7 … recw) - ]. - -ndefinition w16_to_recw16_aux4_9 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,x9〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,x9〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_8 … recw) - ]. - -ndefinition w16_to_recw16_aux4_10 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xA〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xA〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_9 … recw) - ]. - -ndefinition w16_to_recw16_aux4_11 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xB〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xB〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_10 … recw) - ]. - -ndefinition w16_to_recw16_aux4_12 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xC〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xC〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_11 … recw) - ]. - -ndefinition w16_to_recw16_aux4_13 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xD〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xD〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_12 … recw) - ]. - -ndefinition w16_to_recw16_aux4_14 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xE〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xE〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_13 … recw) - ]. - -ndefinition w16_to_recw16_aux4_15 : Πn,e.rec_word16 〈n:〈e,x0〉〉 → rec_word16 〈n:〈e,xF〉〉 ≝ -λn,e. - match e return λx.rec_word16 〈n:〈x,x0〉〉 → rec_word16 〈n:〈x,xF〉〉 with - [ x0 ⇒ λrecw:rec_word16 〈n:〈x0,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x1 ⇒ λrecw:rec_word16 〈n:〈x1,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x2 ⇒ λrecw:rec_word16 〈n:〈x2,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x3 ⇒ λrecw:rec_word16 〈n:〈x3,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x4 ⇒ λrecw:rec_word16 〈n:〈x4,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x5 ⇒ λrecw:rec_word16 〈n:〈x5,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x6 ⇒ λrecw:rec_word16 〈n:〈x6,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x7 ⇒ λrecw:rec_word16 〈n:〈x7,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x8 ⇒ λrecw:rec_word16 〈n:〈x8,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | x9 ⇒ λrecw:rec_word16 〈n:〈x9,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xA ⇒ λrecw:rec_word16 〈n:〈xA,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xB ⇒ λrecw:rec_word16 〈n:〈xB,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xC ⇒ λrecw:rec_word16 〈n:〈xC,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xD ⇒ λrecw:rec_word16 〈n:〈xD,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xE ⇒ λrecw:rec_word16 〈n:〈xE,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - | xF ⇒ λrecw:rec_word16 〈n:〈xF,x0〉〉.w16_S ? (w16_to_recw16_aux4_14 … recw) - ]. - -(* ... cifra esadecimale n.1 *) -ndefinition w16_to_recw16_aux4 ≝ -λb,e,n.λrecw:rec_word16 〈b:〈e,x0〉〉. - match n return λx.rec_word16 〈b:〈e,x〉〉 with - [ x0 ⇒ recw - | x1 ⇒ w16_to_recw16_aux4_1 … recw - | x2 ⇒ w16_to_recw16_aux4_2 … recw - | x3 ⇒ w16_to_recw16_aux4_3 … recw - | x4 ⇒ w16_to_recw16_aux4_4 … recw - | x5 ⇒ w16_to_recw16_aux4_5 … recw - | x6 ⇒ w16_to_recw16_aux4_6 … recw - | x7 ⇒ w16_to_recw16_aux4_7 … recw - | x8 ⇒ w16_to_recw16_aux4_8 … recw - | x9 ⇒ w16_to_recw16_aux4_9 … recw - | xA ⇒ w16_to_recw16_aux4_10 … recw - | xB ⇒ w16_to_recw16_aux4_11 … recw - | xC ⇒ w16_to_recw16_aux4_12 … recw - | xD ⇒ w16_to_recw16_aux4_13 … recw - | xE ⇒ w16_to_recw16_aux4_14 … recw - | xF ⇒ w16_to_recw16_aux4_15 … recw - ]. - -ndefinition w16_to_recw16 : Πw.rec_word16 w ≝ -λw. - match w with [ mk_word16 h l ⇒ - match l with [ mk_byte8 lh ll ⇒ - w16_to_recw16_aux4 h lh ll (w16_to_recw16_aux3 h lh (w16_to_recw16_aux2 h (b8_to_recb8 h))) ]]. diff --git a/helm/software/matita/contribs/ng_assembly/num/word16_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/word16_lemmas.ma deleted file mode 100755 index 2e38a06fc..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/word16_lemmas.ma +++ /dev/null @@ -1,377 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". -include "num/byte8_lemmas.ma". - -(* **** *) -(* WORD *) -(* **** *) - -nlemma word16_destruct_1 : -∀x1,x2,y1,y2. - mk_word16 x1 y1 = mk_word16 x2 y2 → x1 = x2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_word16 x2 y2 with [ mk_word16 a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma word16_destruct_2 : -∀x1,x2,y1,y2. - mk_word16 x1 y1 = mk_word16 x2 y2 → y1 = y2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_word16 x2 y2 with [ mk_word16 _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqw16 : symmetricT word16 bool eq_w16. - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange with (((eq_b8 b3 b1)⊗(eq_b8 b4 b2)) = ((eq_b8 b1 b3)⊗(eq_b8 b2 b4))); - nrewrite > (symmetric_eqb8 b1 b3); - nrewrite > (symmetric_eqb8 b2 b4); - napply refl_eq. -nqed. - -nlemma symmetric_andw16 : symmetricT word16 word16 and_w16. - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange with ((mk_word16 (and_b8 b3 b1) (and_b8 b4 b2)) = (mk_word16 (and_b8 b1 b3) (and_b8 b2 b4))); - nrewrite > (symmetric_andb8 b1 b3); - nrewrite > (symmetric_andb8 b2 b4); - napply refl_eq. -nqed. - -nlemma associative_andw16 : ∀w1,w2,w3.(and_w16 (and_w16 w1 w2) w3) = (and_w16 w1 (and_w16 w2 w3)). - #w1; #w2; #w3; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nelim w3; - #b5; #b6; - nchange with (mk_word16 (and_b8 (and_b8 b1 b3) b5) (and_b8 (and_b8 b2 b4) b6) = - mk_word16 (and_b8 b1 (and_b8 b3 b5)) (and_b8 b2 (and_b8 b4 b6))); - nrewrite < (associative_andb8 b1 b3 b5); - nrewrite < (associative_andb8 b2 b4 b6); - napply refl_eq. -nqed. - -nlemma symmetric_orw16 : symmetricT word16 word16 or_w16. - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange with ((mk_word16 (or_b8 b3 b1) (or_b8 b4 b2)) = (mk_word16 (or_b8 b1 b3) (or_b8 b2 b4))); - nrewrite > (symmetric_orb8 b1 b3); - nrewrite > (symmetric_orb8 b2 b4); - napply refl_eq. -nqed. - -nlemma associative_orw16 : ∀w1,w2,w3.(or_w16 (or_w16 w1 w2) w3) = (or_w16 w1 (or_w16 w2 w3)). - #w1; #w2; #w3; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nelim w3; - #b5; #b6; - nchange with (mk_word16 (or_b8 (or_b8 b1 b3) b5) (or_b8 (or_b8 b2 b4) b6) = - mk_word16 (or_b8 b1 (or_b8 b3 b5)) (or_b8 b2 (or_b8 b4 b6))); - nrewrite < (associative_orb8 b1 b3 b5); - nrewrite < (associative_orb8 b2 b4 b6); - napply refl_eq. -nqed. - -nlemma symmetric_xorw16 : symmetricT word16 word16 xor_w16. - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange with ((mk_word16 (xor_b8 b3 b1) (xor_b8 b4 b2)) = (mk_word16 (xor_b8 b1 b3) (xor_b8 b2 b4))); - nrewrite > (symmetric_xorb8 b1 b3); - nrewrite > (symmetric_xorb8 b2 b4); - napply refl_eq. -nqed. - -nlemma associative_xorw16 : ∀w1,w2,w3.(xor_w16 (xor_w16 w1 w2) w3) = (xor_w16 w1 (xor_w16 w2 w3)). - #w1; #w2; #w3; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nelim w3; - #b5; #b6; - nchange with (mk_word16 (xor_b8 (xor_b8 b1 b3) b5) (xor_b8 (xor_b8 b2 b4) b6) = - mk_word16 (xor_b8 b1 (xor_b8 b3 b5)) (xor_b8 b2 (xor_b8 b4 b6))); - nrewrite < (associative_xorb8 b1 b3 b5); - nrewrite < (associative_xorb8 b2 b4 b6); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_dc_dc : ∀w1,w2,c.plus_w16_dc_dc w1 w2 c = plus_w16_dc_dc w2 w1 c. - #w1; #w2; #c; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - match plus_b8_dc_dc b2 b4 c with [ pair l c ⇒ match plus_b8_dc_dc b1 b3 c with [ pair h c' ⇒ pair … 〈h:l〉 c' ]] = - match plus_b8_dc_dc b4 b2 c with [ pair l c ⇒ match plus_b8_dc_dc b3 b1 c with [ pair h c' ⇒ pair … 〈h:l〉 c' ]]); - nrewrite > (symmetric_plusb8_dc_dc b4 b2 c); - ncases (plus_b8_dc_dc b2 b4 c); - #b5; #c1; - nchange with ( - match plus_b8_dc_dc b1 b3 c1 with [ pair h c' ⇒ pair … 〈h:b5〉 c' ] = - match plus_b8_dc_dc b3 b1 c1 with [ pair h c' ⇒ pair … 〈h:b5〉 c' ]); - nrewrite > (symmetric_plusb8_dc_dc b1 b3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_dc_d : ∀w1,w2,c.plus_w16_dc_d w1 w2 c = plus_w16_dc_d w2 w1 c. - #w1; #w2; #c; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - match plus_b8_dc_dc b2 b4 c with [ pair l c ⇒ 〈plus_b8_dc_d b1 b3 c:l〉 ] = - match plus_b8_dc_dc b4 b2 c with [ pair l c ⇒ 〈plus_b8_dc_d b3 b1 c:l〉 ]); - nrewrite > (symmetric_plusb8_dc_dc b4 b2 c); - ncases (plus_b8_dc_dc b2 b4 c); - #b5; #c1; - nchange with (〈plus_b8_dc_d b1 b3 c1:b5〉 = 〈plus_b8_dc_d b3 b1 c1:b5〉); - nrewrite > (symmetric_plusb8_dc_d b1 b3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_dc_c : ∀w1,w2,c.plus_w16_dc_c w1 w2 c = plus_w16_dc_c w2 w1 c. - #w1; #w2; #c; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - plus_b8_dc_c b1 b3 (plus_b8_dc_c b2 b4 c) = - plus_b8_dc_c b3 b1 (plus_b8_dc_c b4 b2 c)); - nrewrite > (symmetric_plusb8_dc_c b4 b2 c); - nrewrite > (symmetric_plusb8_dc_c b3 b1 (plus_b8_dc_c b2 b4 c)); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_d_dc : ∀w1,w2.plus_w16_d_dc w1 w2 = plus_w16_d_dc w2 w1. - #w1; #w2; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - match plus_b8_d_dc b2 b4 with [ pair l c ⇒ match plus_b8_dc_dc b1 b3 c with [ pair h c' ⇒ pair … 〈h:l〉 c' ]] = - match plus_b8_d_dc b4 b2 with [ pair l c ⇒ match plus_b8_dc_dc b3 b1 c with [ pair h c' ⇒ pair … 〈h:l〉 c' ]]); - nrewrite > (symmetric_plusb8_d_dc b4 b2); - ncases (plus_b8_d_dc b2 b4); - #b5; #c; - nchange with ( - match plus_b8_dc_dc b1 b3 c with [ pair h c' ⇒ pair … 〈h:b5〉 c' ] = - match plus_b8_dc_dc b3 b1 c with [ pair h c' ⇒ pair … 〈h:b5〉 c' ]); - nrewrite > (symmetric_plusb8_dc_dc b1 b3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_d_d : ∀w1,w2.plus_w16_d_d w1 w2 = plus_w16_d_d w2 w1. - #w1; #w2; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - match plus_b8_d_dc b2 b4 with [ pair l c ⇒ 〈plus_b8_dc_d b1 b3 c:l〉 ] = - match plus_b8_d_dc b4 b2 with [ pair l c ⇒ 〈plus_b8_dc_d b3 b1 c:l〉 ]); - nrewrite > (symmetric_plusb8_d_dc b4 b2); - ncases (plus_b8_d_dc b2 b4); - #b5; #c; - nchange with (〈plus_b8_dc_d b1 b3 c:b5〉 = 〈plus_b8_dc_d b3 b1 c:b5〉); - nrewrite > (symmetric_plusb8_dc_d b1 b3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusw16_d_c : ∀w1,w2.plus_w16_d_c w1 w2 = plus_w16_d_c w2 w1. - #w1; #w2; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with ( - plus_b8_dc_c b1 b3 (plus_b8_d_c b2 b4) = - plus_b8_dc_c b3 b1 (plus_b8_d_c b4 b2)); - nrewrite > (symmetric_plusb8_d_c b4 b2); - nrewrite > (symmetric_plusb8_dc_c b3 b1 (plus_b8_d_c b2 b4)); - napply refl_eq. -nqed. - -nlemma symmetric_mulb8 : symmetricT byte8 word16 mul_b8. - #b1; #b2; - nelim b1; - #e1; #e2; - nelim b2; - #e3; #e4; - nchange with (match mul_ex e2 e4 with - [ mk_byte8 t1_h t1_l ⇒ match mul_ex e1 e4 with - [ mk_byte8 t2_h t2_l ⇒ match mul_ex e3 e2 with - [ mk_byte8 t3_h t3_l ⇒ match mul_ex e1 e3 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,t3_h〉:〈t3_l,x0〉〉 〈〈x0,t2_h〉:〈t2_l,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈t1_h,t1_l〉〉 - ]]]] = match mul_ex e4 e2 with - [ mk_byte8 t1_h t1_l ⇒ match mul_ex e3 e2 with - [ mk_byte8 t2_h t2_l ⇒ match mul_ex e1 e4 with - [ mk_byte8 t3_h t3_l ⇒ match mul_ex e3 e1 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,t3_h〉:〈t3_l,x0〉〉 〈〈x0,t2_h〉:〈t2_l,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈t1_h,t1_l〉〉 - ]]]]); - nrewrite < (symmetric_mulex e2 e4); - ncases (mul_ex e2 e4); - #e5; #e6; - nchange with (match mul_ex e1 e4 with - [ mk_byte8 t2_h t2_l ⇒ match mul_ex e3 e2 with - [ mk_byte8 t3_h t3_l ⇒ match mul_ex e1 e3 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,t3_h〉:〈t3_l,x0〉〉 〈〈x0,t2_h〉:〈t2_l,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉 - ]]] = match mul_ex e3 e2 with - [ mk_byte8 t2_h t2_l ⇒ match mul_ex e1 e4 with - [ mk_byte8 t3_h t3_l ⇒ match mul_ex e3 e1 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,t3_h〉:〈t3_l,x0〉〉 〈〈x0,t2_h〉:〈t2_l,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉 - ]]]); - ncases (mul_ex e3 e2); - #e7; #e8; - ncases (mul_ex e1 e4); - #e9; #e10; - nchange with (match mul_ex e1 e3 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,e7〉:〈e8,x0〉〉 〈〈x0,e9〉:〈e10,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉 - ] = match mul_ex e3 e1 with - [ mk_byte8 t4_h t4_l ⇒ plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,e9〉:〈e10,x0〉〉 〈〈x0,e7〉:〈e8,x0〉〉) 〈〈t4_h,t4_l〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉 - ]); - nrewrite < (symmetric_mulex e1 e3); - ncases (mul_ex e1 e3); - #e11; #e12; - nchange with ((plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,e7〉:〈e8,x0〉〉 〈〈x0,e9〉:〈e10,x0〉〉) 〈〈e11,e12〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉) = - (plus_w16_d_d (plus_w16_d_d (plus_w16_d_d 〈〈x0,e9〉:〈e10,x0〉〉 〈〈x0,e7〉:〈e8,x0〉〉) 〈〈e11,e12〉:〈x0,x0〉〉)〈〈x0,x0〉:〈e5,e6〉〉)); - nrewrite > (symmetric_plusw16_d_d 〈〈x0,e7〉:〈e8,x0〉〉 〈〈x0,e9〉:〈e10,x0〉〉); - napply refl_eq. -nqed. - -nlemma eqw16_to_eq : ∀w1,w2:word16.(eq_w16 w1 w2 = true) → (w1 = w2). - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange in ⊢ (% → ?) with (((eq_b8 b3 b1)⊗(eq_b8 b4 b2)) = true); - #H; - nrewrite < (eqb8_to_eq … (andb_true_true_l … H)); - nrewrite < (eqb8_to_eq … (andb_true_true_r … H)); - napply refl_eq. -nqed. - -nlemma eq_to_eqw16 : ∀w1,w2.w1 = w2 → eq_w16 w1 w2 = true. - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - #H; - nrewrite < (word16_destruct_1 … H); - nrewrite < (word16_destruct_2 … H); - nchange with (((eq_b8 b3 b3)⊗(eq_b8 b4 b4)) = true); - nrewrite > (eq_to_eqb8 b3 b3 (refl_eq …)); - nrewrite > (eq_to_eqb8 b4 b4 (refl_eq …)); - nnormalize; - napply refl_eq. -nqed. - -nlemma decidable_w16_aux1 : ∀b1,b2,b3,b4.b1 ≠ b3 → 〈b1:b2〉 ≠ 〈b3:b4〉. - #b1; #b2; #b3; #b4; - nnormalize; #H; #H1; - napply (H (word16_destruct_1 … H1)). -nqed. - -nlemma decidable_w16_aux2 : ∀b1,b2,b3,b4.b2 ≠ b4 → 〈b1:b2〉 ≠ 〈b3:b4〉. - #b1; #b2; #b3; #b4; - nnormalize; #H; #H1; - napply (H (word16_destruct_2 … H1)). -nqed. - -nlemma decidable_w16 : ∀x,y:word16.decidable (x = y). - #x; nelim x; #b1; #b2; - #y; nelim y; #b3; #b4; - nnormalize; - napply (or2_elim (b1 = b3) (b1 ≠ b3) ? (decidable_b8 b1 b3) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_w16_aux1 b1 b2 b3 b4 H)) - ##| ##1: #H; napply (or2_elim (b2 = b4) (b2 ≠ b4) ? (decidable_b8 b2 b4) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_w16_aux2 b1 b2 b3 b4 H1)) - ##| ##1: #H1; nrewrite > H; nrewrite > H1; - napply (or2_intro1 … (refl_eq ? 〈b3:b4〉)) - ##] - ##] -nqed. - -nlemma neqw16_to_neq : ∀w1,w2:word16.(eq_w16 w1 w2 = false) → (w1 ≠ w2). - #w1; #w2; - nelim w1; - nelim w2; - #b1; #b2; #b3; #b4; - nchange with ((((eq_b8 b3 b1) ⊗ (eq_b8 b4 b2)) = false) → ?); - #H; - napply (or2_elim ((eq_b8 b3 b1) = false) ((eq_b8 b4 b2) = false) ? (andb_false2 … H) …); - ##[ ##1: #H1; napply (decidable_w16_aux1 … (neqb8_to_neq … H1)) - ##| ##2: #H1; napply (decidable_w16_aux2 … (neqb8_to_neq … H1)) - ##] -nqed. - -nlemma word16_destruct : ∀b1,b2,b3,b4.〈b1:b2〉 ≠ 〈b3:b4〉 → b1 ≠ b3 ∨ b2 ≠ b4. - #b1; #b2; #b3; #b4; - nnormalize; #H; - napply (or2_elim (b1 = b3) (b1 ≠ b3) ? (decidable_b8 b1 b3) …); - ##[ ##2: #H1; napply (or2_intro1 … H1) - ##| ##1: #H1; napply (or2_elim (b2 = b4) (b2 ≠ b4) ? (decidable_b8 b2 b4) …); - ##[ ##2: #H2; napply (or2_intro2 … H2) - ##| ##1: #H2; nrewrite > H1 in H:(%); - nrewrite > H2; - #H; nelim (H (refl_eq …)) - ##] - ##] -nqed. - -nlemma neq_to_neqw16 : ∀w1,w2.w1 ≠ w2 → eq_w16 w1 w2 = false. - #w1; #w2; - nelim w1; #b1; #b2; - nelim w2; #b3; #b4; - #H; nchange with (((eq_b8 b1 b3) ⊗ (eq_b8 b2 b4)) = false); - napply (or2_elim (b1 ≠ b3) (b2 ≠ b4) ? (word16_destruct … H) …); - ##[ ##1: #H1; nrewrite > (neq_to_neqb8 … H1); nnormalize; napply refl_eq - ##| ##2: #H1; nrewrite > (neq_to_neqb8 … H1); - nrewrite > (symmetric_andbool (eq_b8 b1 b3) false); - nnormalize; napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/num/word32.ma b/helm/software/matita/contribs/ng_assembly/num/word32.ma deleted file mode 100755 index bc81cac17..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/word32.ma +++ /dev/null @@ -1,248 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* ***** *) -(* DWORD *) -(* ***** *) - -nrecord word32 : Type ≝ - { - w32h: word16; - w32l: word16 - }. - -(* \langle \rangle *) -notation "〈x.y〉" non associative with precedence 80 - for @{ 'mk_word32 $x $y }. -interpretation "mk_word32" 'mk_word32 x y = (mk_word32 x y). - -(* operatore = *) -ndefinition eq_w32 ≝ λdw1,dw2.(eq_w16 (w32h dw1) (w32h dw2)) ⊗ (eq_w16 (w32l dw1) (w32l dw2)). - -(* operatore < *) -ndefinition lt_w32 ≝ -λdw1,dw2:word32. - (lt_w16 (w32h dw1) (w32h dw2)) ⊕ - ((eq_w16 (w32h dw1) (w32h dw2)) ⊗ (lt_w16 (w32l dw1) (w32l dw2))). - -(* operatore ≤ *) -ndefinition le_w32 ≝ -λdw1,dw2:word32. - (lt_w16 (w32h dw1) (w32h dw2)) ⊕ - ((eq_w16 (w32h dw1) (w32h dw2)) ⊗ (le_w16 (w32l dw1) (w32l dw2))). - -(* operatore > *) -ndefinition gt_w32 ≝ -λdw1,dw2:word32. - (gt_w16 (w32h dw1) (w32h dw2)) ⊕ - ((eq_w16 (w32h dw1) (w32h dw2)) ⊗ (gt_w16 (w32l dw1) (w32l dw2))). - -(* operatore ≥ *) -ndefinition ge_w32 ≝ -λdw1,dw2:word32. - (gt_w16 (w32h dw1) (w32h dw2)) ⊕ - ((eq_w16 (w32h dw1) (w32h dw2)) ⊗ (ge_w16 (w32l dw1) (w32l dw2))). - -(* operatore and *) -ndefinition and_w32 ≝ -λdw1,dw2:word32.mk_word32 (and_w16 (w32h dw1) (w32h dw2)) (and_w16 (w32l dw1) (w32l dw2)). - -(* operatore or *) -ndefinition or_w32 ≝ -λdw1,dw2:word32.mk_word32 (or_w16 (w32h dw1) (w32h dw2)) (or_w16 (w32l dw1) (w32l dw2)). - -(* operatore xor *) -ndefinition xor_w32 ≝ -λdw1,dw2:word32.mk_word32 (xor_w16 (w32h dw1) (w32h dw2)) (xor_w16 (w32l dw1) (w32l dw2)). - -(* operatore rotazione destra con carry *) -ndefinition rcr_w32 ≝ -λdw:word32.λc:bool.match rcr_w16 (w32h dw) c with - [ pair wh' c' ⇒ match rcr_w16 (w32l dw) c' with - [ pair wl' c'' ⇒ pair … (mk_word32 wh' wl') c'' ]]. - -(* operatore shift destro *) -ndefinition shr_w32 ≝ -λdw:word32.match rcr_w16 (w32h dw) false with - [ pair wh' c' ⇒ match rcr_w16 (w32l dw) c' with - [ pair wl' c'' ⇒ pair … (mk_word32 wh' wl') c'' ]]. - -(* operatore rotazione destra *) -ndefinition ror_w32 ≝ -λdw:word32.match rcr_w16 (w32h dw) false with - [ pair wh' c' ⇒ match rcr_w16 (w32l dw) c' with - [ pair wl' c'' ⇒ match c'' with - [ true ⇒ mk_word32 (or_w16 (mk_word16 (mk_byte8 x8 x0) (mk_byte8 x0 x0)) wh') wl' - | false ⇒ mk_word32 wh' wl' ]]]. - -(* operatore rotazione destra n-volte *) -nlet rec ror_w32_n (dw:word32) (n:nat) on n ≝ - match n with - [ O ⇒ dw - | S n' ⇒ ror_w32_n (ror_w32 dw) n' ]. - -(* operatore rotazione sinistra con carry *) -ndefinition rcl_w32 ≝ -λdw:word32.λc:bool.match rcl_w16 (w32l dw) c with - [ pair wl' c' ⇒ match rcl_w16 (w32h dw) c' with - [ pair wh' c'' ⇒ pair … (mk_word32 wh' wl') c'' ]]. - -(* operatore shift sinistro *) -ndefinition shl_w32 ≝ -λdw:word32.match rcl_w16 (w32l dw) false with - [ pair wl' c' ⇒ match rcl_w16 (w32h dw) c' with - [ pair wh' c'' ⇒ pair … (mk_word32 wh' wl') c'' ]]. - -(* operatore rotazione sinistra *) -ndefinition rol_w32 ≝ -λdw:word32.match rcl_w16 (w32l dw) false with - [ pair wl' c' ⇒ match rcl_w16 (w32h dw) c' with - [ pair wh' c'' ⇒ match c'' with - [ true ⇒ mk_word32 wh' (or_w16 (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x0 x1)) wl') - | false ⇒ mk_word32 wh' wl' ]]]. - -(* operatore rotazione sinistra n-volte *) -nlet rec rol_w32_n (dw:word32) (n:nat) on n ≝ - match n with - [ O ⇒ dw - | S n' ⇒ rol_w32_n (rol_w32 dw) n' ]. - -(* operatore not/complemento a 1 *) -ndefinition not_w32 ≝ -λdw:word32.mk_word32 (not_w16 (w32h dw)) (not_w16 (w32l dw)). - -(* operatore somma con data+carry → data+carry *) -ndefinition plus_w32_dc_dc ≝ -λdw1,dw2:word32.λc:bool. - match plus_w16_dc_dc (w32l dw1) (w32l dw2) c with - [ pair l c ⇒ match plus_w16_dc_dc (w32h dw1) (w32h dw2) c with - [ pair h c' ⇒ pair … 〈h.l〉 c' ]]. - -(* operatore somma con data+carry → data *) -ndefinition plus_w32_dc_d ≝ -λdw1,dw2:word32.λc:bool. - match plus_w16_dc_dc (w32l dw1) (w32l dw2) c with - [ pair l c ⇒ 〈plus_w16_dc_d (w32h dw1) (w32h dw2) c.l〉 ]. - -(* operatore somma con data+carry → c *) -ndefinition plus_w32_dc_c ≝ -λdw1,dw2:word32.λc:bool. - plus_w16_dc_c (w32h dw1) (w32h dw2) (plus_w16_dc_c (w32l dw1) (w32l dw2) c). - -(* operatore somma con data → data+carry *) -ndefinition plus_w32_d_dc ≝ -λdw1,dw2:word32. - match plus_w16_d_dc (w32l dw1) (w32l dw2) with - [ pair l c ⇒ match plus_w16_dc_dc (w32h dw1) (w32h dw2) c with - [ pair h c' ⇒ pair … 〈h.l〉 c' ]]. - -(* operatore somma con data → data *) -ndefinition plus_w32_d_d ≝ -λdw1,dw2:word32. - match plus_w16_d_dc (w32l dw1) (w32l dw2) with - [ pair l c ⇒ 〈plus_w16_dc_d (w32h dw1) (w32h dw2) c.l〉 ]. - -(* operatore somma con data → c *) -ndefinition plus_w32_d_c ≝ -λdw1,dw2:word32. - plus_w16_dc_c (w32h dw1) (w32h dw2) (plus_w16_d_c (w32l dw1) (w32l dw2)). - -(* operatore Most Significant Bit *) -ndefinition MSB_w32 ≝ λdw:word32.eq_ex x8 (and_ex x8 (b8h (w16h (w32h dw)))). - -(* operatore predecessore *) -ndefinition pred_w32 ≝ -λdw:word32.match eq_w16 (w32l dw) (mk_word16 (mk_byte8 x0 x0) (mk_byte8 x0 x0)) with - [ true ⇒ mk_word32 (pred_w16 (w32h dw)) (pred_w16 (w32l dw)) - | false ⇒ mk_word32 (w32h dw) (pred_w16 (w32l dw)) ]. - -(* operatore successore *) -ndefinition succ_w32 ≝ -λdw:word32.match eq_w16 (w32l dw) (mk_word16 (mk_byte8 xF xF) (mk_byte8 xF xF)) with - [ true ⇒ mk_word32 (succ_w16 (w32h dw)) (succ_w16 (w32l dw)) - | false ⇒ mk_word32 (w32h dw) (succ_w16 (w32l dw)) ]. - -(* operatore neg/complemento a 2 *) -ndefinition compl_w32 ≝ -λdw:word32.match MSB_w32 dw with - [ true ⇒ succ_w32 (not_w32 dw) - | false ⇒ not_w32 (pred_w32 dw) ]. - -(* - operatore moltiplicazione senza segno: b*b=[0x00000000,0xFFFE0001] - ... in pratica (〈a:b〉*〈c:d〉) = (a*c)<<16+(a*d)<<8+(b*c)<<8+(b*d) -*) -ndefinition mul_w16 ≝ -λw1,w2:word16.match w1 with -[ mk_word16 b1h b1l ⇒ match w2 with -[ mk_word16 b2h b2l ⇒ match mul_b8 b1l b2l with -[ mk_word16 t1_h t1_l ⇒ match mul_b8 b1h b2l with -[ mk_word16 t2_h t2_l ⇒ match mul_b8 b2h b1l with -[ mk_word16 t3_h t3_l ⇒ match mul_b8 b1h b2h with -[ mk_word16 t4_h t4_l ⇒ - plus_w32_d_d - (plus_w32_d_d - (plus_w32_d_d 〈〈〈x0,x0〉:t3_h〉.〈t3_l:〈x0,x0〉〉〉 〈〈〈x0,x0〉:t2_h〉.〈t2_l:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈t1_h:t1_l〉〉 -]]]]]]. - -(* divisione senza segno (secondo la logica delle ALU): (quoziente resto) overflow *) -nlet rec div_w16_aux (divd:word32) (divs:word32) (molt:word16) (q:word16) (c:nat) on c ≝ - let w' ≝ plus_w32_d_d divd (compl_w32 divs) in - match c with - [ O ⇒ match le_w32 divs divd with - [ true ⇒ triple … (or_w16 molt q) (w32l w') (⊖ (eq_w16 (w32h w') 〈〈x0,x0〉:〈x0,x0〉〉)) - | false ⇒ triple … q (w32l divd) (⊖ (eq_w16 (w32h divd) 〈〈x0,x0〉:〈x0,x0〉〉)) ] - | S c' ⇒ match le_w32 divs divd with - [ true ⇒ div_w16_aux w' (ror_w32 divs) (ror_w16 molt) (or_w16 molt q) c' - | false ⇒ div_w16_aux divd (ror_w32 divs) (ror_w16 molt) q c' ]]. - -ndefinition div_w16 ≝ -λw:word32.λb:word16.match eq_w16 b 〈〈x0,x0〉:〈x0,x0〉〉 with -(* - la combinazione n/0 e' illegale, segnala solo overflow senza dare risultato -*) - [ true ⇒ triple … 〈〈xF,xF〉:〈xF,xF〉〉 (w32l w) true - | false ⇒ match eq_w32 w 〈〈〈x0,x0〉:〈x0,x0〉〉.〈〈x0,x0〉:〈x0,x0〉〉〉 with -(* 0 diviso qualsiasi cosa diverso da 0 da' q=0 r=0 o=false *) - [ true ⇒ triple … 〈〈x0,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,x0〉〉 false -(* 1) e' una divisione sensata che produrra' overflow/risultato *) -(* 2) parametri: dividendo, divisore, moltiplicatore, quoziente, contatore *) -(* 3) ad ogni ciclo il divisore e il moltiplicatore vengono scalati di 1 a dx *) -(* 4) il moltiplicatore e' la quantita' aggiunta al quoziente se il divisore *) -(* puo' essere sottratto al dividendo *) - | false ⇒ div_w16_aux w (rol_w32_n 〈〈〈x0,x0〉:〈x0,x0〉〉.b〉 nat15) 〈〈x8,x0〉:〈x0,x0〉〉 〈〈x0,x0〉:〈x0,x0〉〉 nat15 ]]. - -(* operatore x in [inf,sup] o in sup],[inf *) -ndefinition inrange_w32 ≝ -λx,inf,sup:word32. - match le_w32 inf sup with - [ true ⇒ and_bool | false ⇒ or_bool ] - (le_w32 inf x) (le_w32 x sup). - -(* iteratore sulle word *) -ndefinition forall_w32 ≝ - λP. - forall_w16 (λbh. - forall_w16 (λbl. - P (mk_word32 bh bl ))). diff --git a/helm/software/matita/contribs/ng_assembly/num/word32_lemmas.ma b/helm/software/matita/contribs/ng_assembly/num/word32_lemmas.ma deleted file mode 100755 index 026086d8f..000000000 --- a/helm/software/matita/contribs/ng_assembly/num/word32_lemmas.ma +++ /dev/null @@ -1,377 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word32.ma". -include "num/word16_lemmas.ma". - -(* ***** *) -(* DWORD *) -(* ***** *) - -nlemma word32_destruct_1 : -∀x1,x2,y1,y2. - mk_word32 x1 y1 = mk_word32 x2 y2 → x1 = x2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_word32 x2 y2 with [ mk_word32 a _ ⇒ x1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma word32_destruct_2 : -∀x1,x2,y1,y2. - mk_word32 x1 y1 = mk_word32 x2 y2 → y1 = y2. - #x1; #x2; #y1; #y2; #H; - nchange with (match mk_word32 x2 y2 with [ mk_word32 _ b ⇒ y1 = b ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -nlemma symmetric_eqw32 : symmetricT word32 bool eq_w32. - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange with (((eq_w16 w3 w1)⊗(eq_w16 w4 w2)) = ((eq_w16 w1 w3)⊗(eq_w16 w2 w4))); - nrewrite > (symmetric_eqw16 w1 w3); - nrewrite > (symmetric_eqw16 w2 w4); - napply refl_eq. -nqed. - -nlemma symmetric_andw32 : symmetricT word32 word32 and_w32. - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange with ((mk_word32 (and_w16 w3 w1) (and_w16 w4 w2)) = (mk_word32 (and_w16 w1 w3) (and_w16 w2 w4))); - nrewrite > (symmetric_andw16 w1 w3); - nrewrite > (symmetric_andw16 w2 w4); - napply refl_eq. -nqed. - -nlemma associative_andw32 : ∀dw1,dw2,dw3.(and_w32 (and_w32 dw1 dw2) dw3) = (and_w32 dw1 (and_w32 dw2 dw3)). - #dw1; #dw2; #dw3; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nelim dw3; - #w5; #w6; - nchange with (mk_word32 (and_w16 (and_w16 w1 w3) w5) (and_w16 (and_w16 w2 w4) w6) = - mk_word32 (and_w16 w1 (and_w16 w3 w5)) (and_w16 w2 (and_w16 w4 w6))); - nrewrite < (associative_andw16 w1 w3 w5); - nrewrite < (associative_andw16 w2 w4 w6); - napply refl_eq. -nqed. - -nlemma symmetric_orw32 : symmetricT word32 word32 or_w32. - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange with ((mk_word32 (or_w16 w3 w1) (or_w16 w4 w2)) = (mk_word32 (or_w16 w1 w3) (or_w16 w2 w4))); - nrewrite > (symmetric_orw16 w1 w3); - nrewrite > (symmetric_orw16 w2 w4); - napply refl_eq. -nqed. - -nlemma associative_orw32 : ∀dw1,dw2,dw3.(or_w32 (or_w32 dw1 dw2) dw3) = (or_w32 dw1 (or_w32 dw2 dw3)). - #dw1; #dw2; #dw3; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nelim dw3; - #w5; #w6; - nchange with (mk_word32 (or_w16 (or_w16 w1 w3) w5) (or_w16 (or_w16 w2 w4) w6) = - mk_word32 (or_w16 w1 (or_w16 w3 w5)) (or_w16 w2 (or_w16 w4 w6))); - nrewrite < (associative_orw16 w1 w3 w5); - nrewrite < (associative_orw16 w2 w4 w6); - napply refl_eq. -nqed. - -nlemma symmetric_xorw32 : symmetricT word32 word32 xor_w32. - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange with ((mk_word32 (xor_w16 w3 w1) (xor_w16 w4 w2)) = (mk_word32 (xor_w16 w1 w3) (xor_w16 w2 w4))); - nrewrite > (symmetric_xorw16 w1 w3); - nrewrite > (symmetric_xorw16 w2 w4); - napply refl_eq. -nqed. - -nlemma associative_xorw32 : ∀dw1,dw2,dw3.(xor_w32 (xor_w32 dw1 dw2) dw3) = (xor_w32 dw1 (xor_w32 dw2 dw3)). - #dw1; #dw2; #dw3; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nelim dw3; - #w5; #w6; - nchange with (mk_word32 (xor_w16 (xor_w16 w1 w3) w5) (xor_w16 (xor_w16 w2 w4) w6) = - mk_word32 (xor_w16 w1 (xor_w16 w3 w5)) (xor_w16 w2 (xor_w16 w4 w6))); - nrewrite < (associative_xorw16 w1 w3 w5); - nrewrite < (associative_xorw16 w2 w4 w6); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_dc_dc : ∀dw1,dw2,c.plus_w32_dc_dc dw1 dw2 c = plus_w32_dc_dc dw2 dw1 c. - #dw1; #dw2; #c; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - match plus_w16_dc_dc w2 w4 c with [ pair l c ⇒ match plus_w16_dc_dc w1 w3 c with [ pair h c' ⇒ pair … 〈h.l〉 c' ]] = - match plus_w16_dc_dc w4 w2 c with [ pair l c ⇒ match plus_w16_dc_dc w3 w1 c with [ pair h c' ⇒ pair … 〈h.l〉 c' ]]); - nrewrite > (symmetric_plusw16_dc_dc w4 w2 c); - ncases (plus_w16_dc_dc w2 w4 c); - #w5; #c1; - nchange with ( - match plus_w16_dc_dc w1 w3 c1 with [ pair h c' ⇒ pair … 〈h.w5〉 c' ] = - match plus_w16_dc_dc w3 w1 c1 with [ pair h c' ⇒ pair … 〈h.w5〉 c' ]); - nrewrite > (symmetric_plusw16_dc_dc w1 w3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_dc_d : ∀dw1,dw2,c.plus_w32_dc_d dw1 dw2 c = plus_w32_dc_d dw2 dw1 c. - #dw1; #dw2; #c; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - match plus_w16_dc_dc w2 w4 c with [ pair l c ⇒ 〈plus_w16_dc_d w1 w3 c.l〉 ] = - match plus_w16_dc_dc w4 w2 c with [ pair l c ⇒ 〈plus_w16_dc_d w3 w1 c.l〉 ]); - nrewrite > (symmetric_plusw16_dc_dc w4 w2 c); - ncases (plus_w16_dc_dc w2 w4 c); - #w5; #c1; - nchange with (〈plus_w16_dc_d w1 w3 c1.w5〉 = 〈plus_w16_dc_d w3 w1 c1.w5〉); - nrewrite > (symmetric_plusw16_dc_d w1 w3 c1); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_dc_c : ∀dw1,dw2,c.plus_w32_dc_c dw1 dw2 c = plus_w32_dc_c dw2 dw1 c. - #dw1; #dw2; #c; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - plus_w16_dc_c w1 w3 (plus_w16_dc_c w2 w4 c) = - plus_w16_dc_c w3 w1 (plus_w16_dc_c w4 w2 c)); - nrewrite > (symmetric_plusw16_dc_c w4 w2 c); - nrewrite > (symmetric_plusw16_dc_c w3 w1 (plus_w16_dc_c w2 w4 c)); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_d_dc : ∀dw1,dw2.plus_w32_d_dc dw1 dw2 = plus_w32_d_dc dw2 dw1. - #dw1; #dw2; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - match plus_w16_d_dc w2 w4 with [ pair l c ⇒ match plus_w16_dc_dc w1 w3 c with [ pair h c' ⇒ pair … 〈h.l〉 c' ]] = - match plus_w16_d_dc w4 w2 with [ pair l c ⇒ match plus_w16_dc_dc w3 w1 c with [ pair h c' ⇒ pair … 〈h.l〉 c' ]]); - nrewrite > (symmetric_plusw16_d_dc w4 w2); - ncases (plus_w16_d_dc w2 w4); - #w5; #c; - nchange with ( - match plus_w16_dc_dc w1 w3 c with [ pair h c' ⇒ pair … 〈h.w5〉 c' ] = - match plus_w16_dc_dc w3 w1 c with [ pair h c' ⇒ pair … 〈h.w5〉 c' ]); - nrewrite > (symmetric_plusw16_dc_dc w1 w3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_d_d : ∀dw1,dw2.plus_w32_d_d dw1 dw2 = plus_w32_d_d dw2 dw1. - #dw1; #dw2; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - match plus_w16_d_dc w2 w4 with [ pair l c ⇒ 〈plus_w16_dc_d w1 w3 c.l〉 ] = - match plus_w16_d_dc w4 w2 with [ pair l c ⇒ 〈plus_w16_dc_d w3 w1 c.l〉 ]); - nrewrite > (symmetric_plusw16_d_dc w4 w2); - ncases (plus_w16_d_dc w2 w4); - #w5; #c; - nchange with (〈plus_w16_dc_d w1 w3 c.w5〉 = 〈plus_w16_dc_d w3 w1 c.w5〉); - nrewrite > (symmetric_plusw16_dc_d w1 w3 c); - napply refl_eq. -nqed. - -nlemma symmetric_plusw32_d_c : ∀dw1,dw2.plus_w32_d_c dw1 dw2 = plus_w32_d_c dw2 dw1. - #dw1; #dw2; - nelim dw1; - #w1; #w2; - nelim dw2; - #w3; #w4; - nchange with ( - plus_w16_dc_c w1 w3 (plus_w16_d_c w2 w4) = - plus_w16_dc_c w3 w1 (plus_w16_d_c w4 w2)); - nrewrite > (symmetric_plusw16_d_c w4 w2); - nrewrite > (symmetric_plusw16_dc_c w3 w1 (plus_w16_d_c w2 w4)); - napply refl_eq. -nqed. - -nlemma symmetric_mulw16 : symmetricT word16 word32 mul_w16. - #w1; #w2; - nelim w1; - #b1; #b2; - nelim w2; - #b3; #b4; - nchange with (match mul_b8 b2 b4 with - [ mk_word16 t1_h t1_l ⇒ match mul_b8 b1 b4 with - [ mk_word16 t2_h t2_l ⇒ match mul_b8 b3 b2 with - [ mk_word16 t3_h t3_l ⇒ match mul_b8 b1 b3 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:t3_h〉.〈t3_l:〈x0,x0〉〉〉 〈〈〈x0,x0〉:t2_h〉.〈t2_l:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈t1_h:t1_l〉〉 - ]]]] = match mul_b8 b4 b2 with - [ mk_word16 t1_h t1_l ⇒ match mul_b8 b3 b2 with - [ mk_word16 t2_h t2_l ⇒ match mul_b8 b1 b4 with - [ mk_word16 t3_h t3_l ⇒ match mul_b8 b3 b1 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:t3_h〉.〈t3_l:〈x0,x0〉〉〉 〈〈〈x0,x0〉:t2_h〉.〈t2_l:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈t1_h:t1_l〉〉 - ]]]]); - nrewrite < (symmetric_mulb8 b2 b4); - ncases (mul_b8 b2 b4); - #b5; #b6; - nchange with (match mul_b8 b1 b4 with - [ mk_word16 t2_h t2_l ⇒ match mul_b8 b3 b2 with - [ mk_word16 t3_h t3_l ⇒ match mul_b8 b1 b3 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:t3_h〉.〈t3_l:〈x0,x0〉〉〉 〈〈〈x0,x0〉:t2_h〉.〈t2_l:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉 - ]]] = match mul_b8 b3 b2 with - [ mk_word16 t2_h t2_l ⇒ match mul_b8 b1 b4 with - [ mk_word16 t3_h t3_l ⇒ match mul_b8 b3 b1 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:t3_h〉.〈t3_l:〈x0,x0〉〉〉 〈〈〈x0,x0〉:t2_h〉.〈t2_l:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉 - ]]]); - ncases (mul_b8 b3 b2); - #b7; #b8; - ncases (mul_b8 b1 b4); - #b9; #b10; - nchange with (match mul_b8 b1 b3 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:b7〉.〈b8:〈x0,x0〉〉〉 〈〈〈x0,x0〉:b9〉.〈b10:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉 - ] = match mul_b8 b3 b1 with - [ mk_word16 t4_h t4_l ⇒ plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:b9〉.〈b10:〈x0,x0〉〉〉 〈〈〈x0,x0〉:b7〉.〈b8:〈x0,x0〉〉〉) 〈〈t4_h:t4_l〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉 - ]); - nrewrite < (symmetric_mulb8 b1 b3); - ncases (mul_b8 b1 b3); - #b11; #b12; - nchange with ((plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:b7〉.〈b8:〈x0,x0〉〉〉 〈〈〈x0,x0〉:b9〉.〈b10:〈x0,x0〉〉〉) 〈〈b11:b12〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉) = - (plus_w32_d_d (plus_w32_d_d (plus_w32_d_d 〈〈〈x0,x0〉:b9〉.〈b10:〈x0,x0〉〉〉 〈〈〈x0,x0〉:b7〉.〈b8:〈x0,x0〉〉〉) 〈〈b11:b12〉.〈〈x0,x0〉:〈x0,x0〉〉〉)〈〈〈x0,x0〉:〈x0,x0〉〉.〈b5:b6〉〉)); - nrewrite > (symmetric_plusw32_d_d 〈〈〈x0,x0〉:b7〉.〈b8:〈x0,x0〉〉〉 〈〈〈x0,x0〉:b9〉.〈b10:〈x0,x0〉〉〉); - napply refl_eq. -nqed. - -nlemma eqw32_to_eq : ∀dw1,dw2:word32.(eq_w32 dw1 dw2 = true) → (dw1 = dw2). - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange in ⊢ (% → ?) with (((eq_w16 w3 w1)⊗(eq_w16 w4 w2)) = true); - #H; - nrewrite < (eqw16_to_eq … (andb_true_true_l … H)); - nrewrite < (eqw16_to_eq … (andb_true_true_r … H)); - napply refl_eq. -nqed. - -nlemma eq_to_eqw32 : ∀dw1,dw2.dw1 = dw2 → eq_w32 dw1 dw2 = true. - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - #H; - nrewrite < (word32_destruct_1 … H); - nrewrite < (word32_destruct_2 … H); - nchange with (((eq_w16 w3 w3)⊗(eq_w16 w4 w4)) = true); - nrewrite > (eq_to_eqw16 w3 w3 (refl_eq …)); - nrewrite > (eq_to_eqw16 w4 w4 (refl_eq …)); - nnormalize; - napply refl_eq. -nqed. - -nlemma decidable_w32_aux1 : ∀w1,w2,w3,w4.w1 ≠ w3 → 〈w1.w2〉 ≠ 〈w3.w4〉. - #w1; #w2; #w3; #w4; - nnormalize; #H; #H1; - napply (H (word32_destruct_1 … H1)). -nqed. - -nlemma decidable_w32_aux2 : ∀w1,w2,w3,w4.w2 ≠ w4 → 〈w1.w2〉 ≠ 〈w3.w4〉. - #w1; #w2; #w3; #w4; - nnormalize; #H; #H1; - napply (H (word32_destruct_2 … H1)). -nqed. - -nlemma decidable_w32 : ∀x,y:word32.decidable (x = y). - #x; nelim x; #w1; #w2; - #y; nelim y; #w3; #w4; - nnormalize; - napply (or2_elim (w1 = w3) (w1 ≠ w3) ? (decidable_w16 w1 w3) …); - ##[ ##2: #H; napply (or2_intro2 … (decidable_w32_aux1 w1 w2 w3 w4 H)) - ##| ##1: #H; napply (or2_elim (w2 = w4) (w2 ≠ w4) ? (decidable_w16 w2 w4) …); - ##[ ##2: #H1; napply (or2_intro2 … (decidable_w32_aux2 w1 w2 w3 w4 H1)) - ##| ##1: #H1; nrewrite > H; nrewrite > H1; - napply (or2_intro1 … (refl_eq ? 〈w3.w4〉)) - ##] - ##] -nqed. - -nlemma neqw32_to_neq : ∀dw1,dw2:word32.(eq_w32 dw1 dw2 = false) → (dw1 ≠ dw2). - #dw1; #dw2; - nelim dw1; - nelim dw2; - #w1; #w2; #w3; #w4; - nchange with ((((eq_w16 w3 w1) ⊗ (eq_w16 w4 w2)) = false) → ?); - #H; - napply (or2_elim ((eq_w16 w3 w1) = false) ((eq_w16 w4 w2) = false) ? (andb_false2 … H) …); - ##[ ##1: #H1; napply (decidable_w32_aux1 … (neqw16_to_neq … H1)) - ##| ##2: #H1; napply (decidable_w32_aux2 … (neqw16_to_neq … H1)) - ##] -nqed. - -nlemma word32_destruct : ∀w1,w2,w3,w4.〈w1.w2〉 ≠ 〈w3.w4〉 → w1 ≠ w3 ∨ w2 ≠ w4. - #w1; #w2; #w3; #w4; - nnormalize; #H; - napply (or2_elim (w1 = w3) (w1 ≠ w3) ? (decidable_w16 w1 w3) …); - ##[ ##2: #H1; napply (or2_intro1 … H1) - ##| ##1: #H1; napply (or2_elim (w2 = w4) (w2 ≠ w4) ? (decidable_w16 w2 w4) …); - ##[ ##2: #H2; napply (or2_intro2 … H2) - ##| ##1: #H2; nrewrite > H1 in H:(%); - nrewrite > H2; - #H; nelim (H (refl_eq …)) - ##] - ##] -nqed. - -nlemma neq_to_neqw32 : ∀dw1,dw2.dw1 ≠ dw2 → eq_w32 dw1 dw2 = false. - #dw1; #dw2; - nelim dw1; #w1; #w2; - nelim dw2; #w3; #w4; - #H; nchange with (((eq_w16 w1 w3) ⊗ (eq_w16 w2 w4)) = false); - napply (or2_elim (w1 ≠ w3) (w2 ≠ w4) ? (word32_destruct … H) …); - ##[ ##1: #H1; nrewrite > (neq_to_neqw16 … H1); nnormalize; napply refl_eq - ##| ##2: #H1; nrewrite > (neq_to_neqw16 … H1); - nrewrite > (symmetric_andbool (eq_w16 w1 w3) false); - nnormalize; napply refl_eq - ##] -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_opcode_base.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC05_opcode_base.ma deleted file mode 100755 index 4d0300870..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_opcode_base.ma +++ /dev/null @@ -1,222 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* ********************************************** *) -(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) -(* ********************************************** *) - -(* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *) -ninductive HC05_instr_mode: Type ≝ - (* INHERENT = nessun operando *) - MODE_INH : HC05_instr_mode - (* INHERENT = nessun operando (A implicito) *) -| MODE_INHA : HC05_instr_mode - (* INHERENT = nessun operando (X implicito) *) -| MODE_INHX : HC05_instr_mode - - (* INHERENT_ADDRESS = nessun operando (HX implicito) *) -| MODE_INHX0ADD : HC05_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0x00bb) *) -| MODE_INHX1ADD : HC05_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0xwwww) *) -| MODE_INHX2ADD : HC05_instr_mode - - (* IMMEDIATE = operando valore immediato byte = 0xbb *) -| MODE_IMM1 : HC05_instr_mode - (* IMMEDIATE_EXT = operando valore immediato byte = 0xbb -> esteso a word *) -| MODE_IMM1EXT : HC05_instr_mode - (* IMMEDIATE = operando valore immediato word = 0xwwww *) -| MODE_IMM2 : HC05_instr_mode - (* DIRECT = operando offset byte = [0x00bb] *) -| MODE_DIR1 : HC05_instr_mode - (* DIRECT = operando offset word = [0xwwww] *) -| MODE_DIR2 : HC05_instr_mode - (* INDEXED = nessun operando (implicito [X] *) -| MODE_IX0 : HC05_instr_mode - (* INDEXED = operando offset relativo byte = [X+0x00bb] *) -| MODE_IX1 : HC05_instr_mode - (* INDEXED = operando offset relativo word = [X+0xwwww] *) -| MODE_IX2 : HC05_instr_mode - - (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *) - (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *) -| MODE_DIRn : oct → HC05_instr_mode - (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *) - (* + operando valore immediato byte *) - (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *) -| MODE_DIRn_and_IMM1 : oct → HC05_instr_mode -. - -ndefinition eq_HC05_im ≝ -λi1,i2:HC05_instr_mode. - match i1 with - [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ] - | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ true | _ ⇒ false ] - | MODE_INHX ⇒ match i2 with [ MODE_INHX ⇒ true | _ ⇒ false ] - | MODE_INHX0ADD ⇒ match i2 with [ MODE_INHX0ADD ⇒ true | _ ⇒ false ] - | MODE_INHX1ADD ⇒ match i2 with [ MODE_INHX1ADD ⇒ true | _ ⇒ false ] - | MODE_INHX2ADD ⇒ match i2 with [ MODE_INHX2ADD ⇒ true | _ ⇒ false ] - | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1EXT ⇒ match i2 with [ MODE_IMM1EXT ⇒ true | _ ⇒ false ] - | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ true | _ ⇒ false ] - | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR2 ⇒ match i2 with [ MODE_DIR2 ⇒ true | _ ⇒ false ] - | MODE_IX0 ⇒ match i2 with [ MODE_IX0 ⇒ true | _ ⇒ false ] - | MODE_IX1 ⇒ match i2 with [ MODE_IX1 ⇒ true | _ ⇒ false ] - | MODE_IX2 ⇒ match i2 with [ MODE_IX2 ⇒ true | _ ⇒ false ] - | MODE_DIRn n1 ⇒ match i2 with [ MODE_DIRn n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with [ MODE_DIRn_and_IMM1 n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - ]. - -(* iteratore sulle modalita' *) -ndefinition forall_HC05_im ≝ λP:HC05_instr_mode → bool. - P MODE_INH -⊗ P MODE_INHA -⊗ P MODE_INHX -⊗ P MODE_INHX0ADD -⊗ P MODE_INHX1ADD -⊗ P MODE_INHX2ADD -⊗ P MODE_IMM1 -⊗ P MODE_IMM1EXT -⊗ P MODE_IMM2 -⊗ P MODE_DIR1 -⊗ P MODE_DIR2 -⊗ P MODE_IX0 -⊗ P MODE_IX1 -⊗ P MODE_IX2 -⊗ forall_oct (λo. P (MODE_DIRn o)) -⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o)). - -(* enumerazione delle istruzioni *) -ninductive HC05_opcode: Type ≝ - ADC : HC05_opcode (* add with carry *) -| ADD : HC05_opcode (* add *) -| AND : HC05_opcode (* and *) -| ASL : HC05_opcode (* aritmetic shift left *) -| ASR : HC05_opcode (* aritmetic shift right *) -| BCC : HC05_opcode (* branch if C=0 *) -| BCLRn : HC05_opcode (* clear bit n *) -| BCS : HC05_opcode (* branch if C=1 *) -| BEQ : HC05_opcode (* branch if Z=1 *) -| BHCC : HC05_opcode (* branch if H=0 *) -| BHCS : HC05_opcode (* branch if H=1 *) -| BHI : HC05_opcode (* branch if C|Z=0, (higher) *) -| BIH : HC05_opcode (* branch if nIRQ=1 *) -| BIL : HC05_opcode (* branch if nIRQ=0 *) -| BIT : HC05_opcode (* flag = and (bit test) *) -| BLS : HC05_opcode (* branch if C|Z=1 (lower or same) *) -| BMC : HC05_opcode (* branch if I=0 (interrupt mask clear) *) -| BMI : HC05_opcode (* branch if N=1 (minus) *) -| BMS : HC05_opcode (* branch if I=1 (interrupt mask set) *) -| BNE : HC05_opcode (* branch if Z=0 *) -| BPL : HC05_opcode (* branch if N=0 (plus) *) -| BRA : HC05_opcode (* branch always *) -| BRCLRn : HC05_opcode (* branch if bit n clear *) -| BRN : HC05_opcode (* branch never (nop) *) -| BRSETn : HC05_opcode (* branch if bit n set *) -| BSETn : HC05_opcode (* set bit n *) -| BSR : HC05_opcode (* branch to subroutine *) -| CLC : HC05_opcode (* C=0 *) -| CLI : HC05_opcode (* I=0 *) -| CLR : HC05_opcode (* operand=0 *) -| CMP : HC05_opcode (* flag = sub (compare A) *) -| COM : HC05_opcode (* not (1 complement) *) -| CPX : HC05_opcode (* flag = sub (compare X) *) -| DEC : HC05_opcode (* operand=operand-1 (decrement) *) -| EOR : HC05_opcode (* xor *) -| INC : HC05_opcode (* operand=operand+1 (increment) *) -| JMP : HC05_opcode (* jmp word [operand] *) -| JSR : HC05_opcode (* jmp to subroutine *) -| LDA : HC05_opcode (* load in A *) -| LDX : HC05_opcode (* load in X *) -| LSR : HC05_opcode (* logical shift right *) -| MUL : HC05_opcode (* mul *) -| NEG : HC05_opcode (* neg (2 complement) *) -| NOP : HC05_opcode (* nop *) -| ORA : HC05_opcode (* or *) -| ROL : HC05_opcode (* rotate left *) -| ROR : HC05_opcode (* rotate right *) -| RSP : HC05_opcode (* reset SP (0x00FF) *) -| RTI : HC05_opcode (* return from interrupt *) -| RTS : HC05_opcode (* return from subroutine *) -| SBC : HC05_opcode (* sub with carry*) -| SEC : HC05_opcode (* C=1 *) -| SEI : HC05_opcode (* I=1 *) -| STA : HC05_opcode (* store from A *) -| STOP : HC05_opcode (* !!stop mode!! *) -| STX : HC05_opcode (* store from X *) -| SUB : HC05_opcode (* sub *) -| SWI : HC05_opcode (* software interrupt *) -| TAX : HC05_opcode (* X=A (transfer A to X) *) -| TST : HC05_opcode (* flag = sub (test) *) -| TXA : HC05_opcode (* A=X (transfer X to A) *) -| WAIT : HC05_opcode (* !!wait mode!! *) -. - -ndefinition eq_HC05_op ≝ -λop1,op2:HC05_opcode. - match op1 with - [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ] - | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ] - | ASR ⇒ match op2 with [ ASR ⇒ true | _ ⇒ false ] | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] - | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ] | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] - | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ] | BHCC ⇒ match op2 with [ BHCC ⇒ true | _ ⇒ false ] - | BHCS ⇒ match op2 with [ BHCS ⇒ true | _ ⇒ false ] | BHI ⇒ match op2 with [ BHI ⇒ true | _ ⇒ false ] - | BIH ⇒ match op2 with [ BIH ⇒ true | _ ⇒ false ] | BIL ⇒ match op2 with [ BIL ⇒ true | _ ⇒ false ] - | BIT ⇒ match op2 with [ BIT ⇒ true | _ ⇒ false ] | BLS ⇒ match op2 with [ BLS ⇒ true | _ ⇒ false ] - | BMC ⇒ match op2 with [ BMC ⇒ true | _ ⇒ false ] | BMI ⇒ match op2 with [ BMI ⇒ true | _ ⇒ false ] - | BMS ⇒ match op2 with [ BMS ⇒ true | _ ⇒ false ] | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ] - | BPL ⇒ match op2 with [ BPL ⇒ true | _ ⇒ false ] | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] - | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ] | BRN ⇒ match op2 with [ BRN ⇒ true | _ ⇒ false ] - | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ] - | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] - | CLI ⇒ match op2 with [ CLI ⇒ true | _ ⇒ false ] | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ] - | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ] - | CPX ⇒ match op2 with [ CPX ⇒ true | _ ⇒ false ] | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ] - | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ] - | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ] - | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] | LDX ⇒ match op2 with [ LDX ⇒ true | _ ⇒ false ] - | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ] | MUL ⇒ match op2 with [ MUL ⇒ true | _ ⇒ false ] - | NEG ⇒ match op2 with [ NEG ⇒ true | _ ⇒ false ] | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ] - | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ] - | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] | RSP ⇒ match op2 with [ RSP ⇒ true | _ ⇒ false ] - | RTI ⇒ match op2 with [ RTI ⇒ true | _ ⇒ false ] | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ] - | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ] - | SEI ⇒ match op2 with [ SEI ⇒ true | _ ⇒ false ] | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] - | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ] | STX ⇒ match op2 with [ STX ⇒ true | _ ⇒ false ] - | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] | SWI ⇒ match op2 with [ SWI ⇒ true | _ ⇒ false ] - | TAX ⇒ match op2 with [ TAX ⇒ true | _ ⇒ false ] | TST ⇒ match op2 with [ TST ⇒ true | _ ⇒ false ] - | TXA ⇒ match op2 with [ TXA ⇒ true | _ ⇒ false ] | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sugli opcode *) -ndefinition forall_HC05_op ≝ λP:HC05_opcode → bool. - P ADC ⊗ P ADD ⊗ P AND ⊗ P ASL ⊗ P ASR ⊗ P BCC ⊗ P BCLRn ⊗ P BCS ⊗ - P BEQ ⊗ P BHCC ⊗ P BHCS ⊗ P BHI ⊗ P BIH ⊗ P BIL ⊗ P BIT ⊗ P BLS ⊗ - P BMC ⊗ P BMI ⊗ P BMS ⊗ P BNE ⊗ P BPL ⊗ P BRA ⊗ P BRCLRn ⊗ P BRN ⊗ - P BRSETn ⊗ P BSETn ⊗ P BSR ⊗ P CLC ⊗ P CLI ⊗ P CLR ⊗ P CMP ⊗ P COM ⊗ - P CPX ⊗ P DEC ⊗ P EOR ⊗ P INC ⊗ P JMP ⊗ P JSR ⊗ P LDA ⊗ P LDX ⊗ - P LSR ⊗ P MUL ⊗ P NEG ⊗ P NOP ⊗ P ORA ⊗ P ROL ⊗ P ROR ⊗ P RSP ⊗ - P RTI ⊗ P RTS ⊗ P SBC ⊗ P SEC ⊗ P SEI ⊗ P STA ⊗ P STOP ⊗ P STX ⊗ - P SUB ⊗ P SWI ⊗ P TAX ⊗ P TST ⊗ P TXA ⊗ P WAIT. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table.ma deleted file mode 100755 index 04971303d..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table.ma +++ /dev/null @@ -1,378 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/HC05_opcode_base.ma". -include "opcodes/byte_or_word.ma". -include "common/list.ma". - -(* ***************** *) -(* TABELLA DELL'HC05 *) -(* ***************** *) - -(* definizione come concatenazione finale di liste per velocizzare il parsing *) -(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) -(* NB: l'uso di any_opcode m + concatenazione finale tutte liste - impedisce di introdurre opcode disomogenei (per mcu) *) - -ndefinition opcode_table_HC05_1 ≝ -[ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x5〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC05_2 ≝ -[ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x5〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_3 ≝ -[ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x5〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_4 ≝ -[ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x6〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_5 ≝ -[ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x6〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_6 ≝ -[ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_7 ≝ -[ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_8 ≝ -[ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_9 ≝ -[ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x5〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_10 ≝ -[ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,xB〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,xA〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x2〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x2〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x2〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x2〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x2〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_HC05_11 ≝ -[ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x6〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_12 ≝ -[ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x5〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_13 ≝ -[ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x6〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_14 ≝ -[ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x5〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_15 ≝ -[ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x6〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_16 ≝ -[ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x5〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_17 ≝ -[ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x6〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_18 ≝ -[ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_HC05_19 ≝ -[ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x7〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_20 ≝ -[ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x5〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_21 ≝ -[ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x5〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_22 ≝ -[ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x6〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_23 ≝ -[ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x6〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_24 ≝ -[ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x5〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_25 ≝ -[ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x6〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_26 ≝ -[ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x6〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC05_27 ≝ -[ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x5〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_28 ≝ -[ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x5〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x6〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x5〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC05_29 ≝ -[ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x5〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x6〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x5〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC05_30 ≝ -[ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x5〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC05_31 ≝ -[ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x5〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC05 ≝ - opcode_table_HC05_1 @ opcode_table_HC05_2 @ opcode_table_HC05_3 @ opcode_table_HC05_4 @ - opcode_table_HC05_5 @ opcode_table_HC05_6 @ opcode_table_HC05_7 @ opcode_table_HC05_8 @ - opcode_table_HC05_9 @ opcode_table_HC05_10 @ opcode_table_HC05_11 @ opcode_table_HC05_12 @ - opcode_table_HC05_13 @ opcode_table_HC05_14 @ opcode_table_HC05_15 @ opcode_table_HC05_16 @ - opcode_table_HC05_17 @ opcode_table_HC05_18 @ opcode_table_HC05_19 @ opcode_table_HC05_20 @ - opcode_table_HC05_21 @ opcode_table_HC05_22 @ opcode_table_HC05_23 @ opcode_table_HC05_24 @ - opcode_table_HC05_25 @ opcode_table_HC05_26 @ opcode_table_HC05_27 @ opcode_table_HC05_28 @ - opcode_table_HC05_29 @ opcode_table_HC05_30 @ opcode_table_HC05_31. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table_tests.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table_tests.ma deleted file mode 100755 index 4168e01ab..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC05_table_tests.ma +++ /dev/null @@ -1,69 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/opcode.ma". - -(* ***************** *) -(* TABELLA DELL'HC05 *) -(* ***************** *) - -(* HC05: opcode non implementati come da manuale *) -ndefinition HC05_not_impl_byte ≝ - [〈x3,x1〉;〈x3,x2〉;〈x3,x5〉;〈x3,xB〉;〈x3,xE〉 - ;〈x4,x1〉;〈x4,x5〉;〈x4,xB〉;〈x4,xE〉 - ;〈x5,x1〉;〈x5,x2〉;〈x5,x5〉;〈x5,xB〉;〈x5,xE〉 - ;〈x6,x1〉;〈x6,x2〉;〈x6,x5〉;〈x6,xB〉;〈x6,xE〉 - ;〈x7,x1〉;〈x7,x2〉;〈x7,x5〉;〈x7,xB〉;〈x7,xE〉 - ;〈x8,x2〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉 - ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,xE〉 - ;〈xA,x7〉;〈xA,xC〉;〈xA,xF〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_byte_table_HC05 : forall_b8 (λb. - (test_not_impl_byte b HC05_not_impl_byte ⊙ eq_w16 (get_byte_count HC05 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b HC05_not_impl_byte) ⊙ eq_w16 (get_byte_count HC05 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* tutti op implementati *) -nlemma ok_pseudo_table_HC05 : - forall_op HC05 (λo. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC05 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) = true. - napply refl_eq. -nqed. - -(* tutte im implementate *) -nlemma ok_mode_table_HC05 : - forall_im HC05 (λi. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC05 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) = true. - napply refl_eq. -nqed. - -(* nessuna ripetizione di combinazione op + imm *) -nlemma ok_OpIm_table_HC05 : - forall_im HC05 (λi. - forall_op HC05 (λo. - le_w16 (get_OpIm_count HC05 o i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_opcode_base.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC08_opcode_base.ma deleted file mode 100755 index 525b48cbb..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_opcode_base.ma +++ /dev/null @@ -1,330 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* ********************************************** *) -(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) -(* ********************************************** *) - -(* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *) -ninductive HC08_instr_mode: Type ≝ - (* INHERENT = nessun operando *) - MODE_INH : HC08_instr_mode - (* INHERENT = nessun operando (A implicito) *) -| MODE_INHA : HC08_instr_mode - (* INHERENT = nessun operando (X implicito) *) -| MODE_INHX : HC08_instr_mode - (* INHERENT = nessun operando (H implicito) *) -| MODE_INHH : HC08_instr_mode - - (* INHERENT_ADDRESS = nessun operando (HX implicito) *) -| MODE_INHX0ADD : HC08_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0x00bb) *) -| MODE_INHX1ADD : HC08_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0xwwww) *) -| MODE_INHX2ADD : HC08_instr_mode - - (* IMMEDIATE = operando valore immediato byte = 0xbb *) -| MODE_IMM1 : HC08_instr_mode - (* IMMEDIATE_EXT = operando valore immediato byte = 0xbb -> esteso a word *) -| MODE_IMM1EXT : HC08_instr_mode - (* IMMEDIATE = operando valore immediato word = 0xwwww *) -| MODE_IMM2 : HC08_instr_mode - (* DIRECT = operando offset byte = [0x00bb] *) -| MODE_DIR1 : HC08_instr_mode - (* DIRECT = operando offset word = [0xwwww] *) -| MODE_DIR2 : HC08_instr_mode - (* INDEXED = nessun operando (implicito [X] *) -| MODE_IX0 : HC08_instr_mode - (* INDEXED = operando offset relativo byte = [X+0x00bb] *) -| MODE_IX1 : HC08_instr_mode - (* INDEXED = operando offset relativo word = [X+0xwwww] *) -| MODE_IX2 : HC08_instr_mode - (* INDEXED = operando offset relativo byte = [SP+0x00bb] *) -| MODE_SP1 : HC08_instr_mode - (* INDEXED = operando offset relativo word = [SP+0xwwww] *) -| MODE_SP2 : HC08_instr_mode - - (* DIRECT → DIRECT = carica da diretto/scrive su diretto *) -| MODE_DIR1_to_DIR1 : HC08_instr_mode - (* IMMEDIATE → DIRECT = carica da immediato/scrive su diretto *) -| MODE_IMM1_to_DIR1 : HC08_instr_mode - (* INDEXED++ → DIRECT = carica da [X]/scrive su diretto/H:X++ *) -| MODE_IX0p_to_DIR1 : HC08_instr_mode - (* DIRECT → INDEXED++ = carica da diretto/scrive su [X]/H:X++ *) -| MODE_DIR1_to_IX0p : HC08_instr_mode - - (* INHERENT(A) + IMMEDIATE *) -| MODE_INHA_and_IMM1 : HC08_instr_mode - (* INHERENT(X) + IMMEDIATE *) -| MODE_INHX_and_IMM1 : HC08_instr_mode - (* IMMEDIATE + IMMEDIATE *) -| MODE_IMM1_and_IMM1 : HC08_instr_mode - (* DIRECT + IMMEDIATE *) -| MODE_DIR1_and_IMM1 : HC08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_IX0_and_IMM1 : HC08_instr_mode - (* INDEXED++ + IMMEDIATE *) -| MODE_IX0p_and_IMM1 : HC08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_IX1_and_IMM1 : HC08_instr_mode - (* INDEXED++ + IMMEDIATE *) -| MODE_IX1p_and_IMM1 : HC08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_SP1_and_IMM1 : HC08_instr_mode - - (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *) - (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *) -| MODE_DIRn : oct → HC08_instr_mode - (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *) - (* + operando valore immediato byte *) - (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *) -| MODE_DIRn_and_IMM1 : oct → HC08_instr_mode -. - -ndefinition eq_HC08_im ≝ -λi1,i2:HC08_instr_mode. - match i1 with - [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ] - | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ true | _ ⇒ false ] - | MODE_INHX ⇒ match i2 with [ MODE_INHX ⇒ true | _ ⇒ false ] - | MODE_INHH ⇒ match i2 with [ MODE_INHH ⇒ true | _ ⇒ false ] - | MODE_INHX0ADD ⇒ match i2 with [ MODE_INHX0ADD ⇒ true | _ ⇒ false ] - | MODE_INHX1ADD ⇒ match i2 with [ MODE_INHX1ADD ⇒ true | _ ⇒ false ] - | MODE_INHX2ADD ⇒ match i2 with [ MODE_INHX2ADD ⇒ true | _ ⇒ false ] - | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1EXT ⇒ match i2 with [ MODE_IMM1EXT ⇒ true | _ ⇒ false ] - | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ true | _ ⇒ false ] - | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR2 ⇒ match i2 with [ MODE_DIR2 ⇒ true | _ ⇒ false ] - | MODE_IX0 ⇒ match i2 with [ MODE_IX0 ⇒ true | _ ⇒ false ] - | MODE_IX1 ⇒ match i2 with [ MODE_IX1 ⇒ true | _ ⇒ false ] - | MODE_IX2 ⇒ match i2 with [ MODE_IX2 ⇒ true | _ ⇒ false ] - | MODE_SP1 ⇒ match i2 with [ MODE_SP1 ⇒ true | _ ⇒ false ] - | MODE_SP2 ⇒ match i2 with [ MODE_SP2 ⇒ true | _ ⇒ false ] - | MODE_DIR1_to_DIR1 ⇒ match i2 with [ MODE_DIR1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_to_DIR1 ⇒ match i2 with [ MODE_IMM1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_IX0p_to_DIR1 ⇒ match i2 with [ MODE_IX0p_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_to_IX0p ⇒ match i2 with [ MODE_DIR1_to_IX0p ⇒ true | _ ⇒ false ] - | MODE_INHA_and_IMM1 ⇒ match i2 with [ MODE_INHA_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_INHX_and_IMM1 ⇒ match i2 with [ MODE_INHX_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_and_IMM1 ⇒ match i2 with [ MODE_IMM1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_and_IMM1 ⇒ match i2 with [ MODE_DIR1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX0_and_IMM1 ⇒ match i2 with [ MODE_IX0_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX0p_and_IMM1 ⇒ match i2 with [ MODE_IX0p_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX1_and_IMM1 ⇒ match i2 with [ MODE_IX1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX1p_and_IMM1 ⇒ match i2 with [ MODE_IX1p_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_SP1_and_IMM1 ⇒ match i2 with [ MODE_SP1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIRn n1 ⇒ match i2 with [ MODE_DIRn n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with [ MODE_DIRn_and_IMM1 n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - ]. - -(* iteratore sulle modalita' *) -ndefinition forall_HC08_im ≝ λP:HC08_instr_mode → bool. - P MODE_INH -⊗ P MODE_INHA -⊗ P MODE_INHX -⊗ P MODE_INHH -⊗ P MODE_INHX0ADD -⊗ P MODE_INHX1ADD -⊗ P MODE_INHX2ADD -⊗ P MODE_IMM1 -⊗ P MODE_IMM1EXT -⊗ P MODE_IMM2 -⊗ P MODE_DIR1 -⊗ P MODE_DIR2 -⊗ P MODE_IX0 -⊗ P MODE_IX1 -⊗ P MODE_IX2 -⊗ P MODE_SP1 -⊗ P MODE_SP2 -⊗ P MODE_DIR1_to_DIR1 -⊗ P MODE_IMM1_to_DIR1 -⊗ P MODE_IX0p_to_DIR1 -⊗ P MODE_DIR1_to_IX0p -⊗ P MODE_INHA_and_IMM1 -⊗ P MODE_INHX_and_IMM1 -⊗ P MODE_IMM1_and_IMM1 -⊗ P MODE_DIR1_and_IMM1 -⊗ P MODE_IX0_and_IMM1 -⊗ P MODE_IX0p_and_IMM1 -⊗ P MODE_IX1_and_IMM1 -⊗ P MODE_IX1p_and_IMM1 -⊗ P MODE_SP1_and_IMM1 -⊗ forall_oct (λo. P (MODE_DIRn o)) -⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o)). - -(* enumerazione delle istruzioni *) -ninductive HC08_opcode: Type ≝ - ADC : HC08_opcode (* add with carry *) -| ADD : HC08_opcode (* add *) -| AIS : HC08_opcode (* add immediate to SP *) -| AIX : HC08_opcode (* add immediate to X *) -| AND : HC08_opcode (* and *) -| ASL : HC08_opcode (* aritmetic shift left *) -| ASR : HC08_opcode (* aritmetic shift right *) -| BCC : HC08_opcode (* branch if C=0 *) -| BCLRn : HC08_opcode (* clear bit n *) -| BCS : HC08_opcode (* branch if C=1 *) -| BEQ : HC08_opcode (* branch if Z=1 *) -| BGE : HC08_opcode (* branch if N⊙V=0 (great or equal) *) -| BGT : HC08_opcode (* branch if Z|N⊙V=0 clear (great) *) -| BHCC : HC08_opcode (* branch if H=0 *) -| BHCS : HC08_opcode (* branch if H=1 *) -| BHI : HC08_opcode (* branch if C|Z=0, (higher) *) -| BIH : HC08_opcode (* branch if nIRQ=1 *) -| BIL : HC08_opcode (* branch if nIRQ=0 *) -| BIT : HC08_opcode (* flag = and (bit test) *) -| BLE : HC08_opcode (* branch if Z|N⊙V=1 (less or equal) *) -| BLS : HC08_opcode (* branch if C|Z=1 (lower or same) *) -| BLT : HC08_opcode (* branch if N⊙1=1 (less) *) -| BMC : HC08_opcode (* branch if I=0 (interrupt mask clear) *) -| BMI : HC08_opcode (* branch if N=1 (minus) *) -| BMS : HC08_opcode (* branch if I=1 (interrupt mask set) *) -| BNE : HC08_opcode (* branch if Z=0 *) -| BPL : HC08_opcode (* branch if N=0 (plus) *) -| BRA : HC08_opcode (* branch always *) -| BRCLRn : HC08_opcode (* branch if bit n clear *) -| BRN : HC08_opcode (* branch never (nop) *) -| BRSETn : HC08_opcode (* branch if bit n set *) -| BSETn : HC08_opcode (* set bit n *) -| BSR : HC08_opcode (* branch to subroutine *) -| CBEQA : HC08_opcode (* compare (A) and BEQ *) -| CBEQX : HC08_opcode (* compare (X) and BEQ *) -| CLC : HC08_opcode (* C=0 *) -| CLI : HC08_opcode (* I=0 *) -| CLR : HC08_opcode (* operand=0 *) -| CMP : HC08_opcode (* flag = sub (compare A) *) -| COM : HC08_opcode (* not (1 complement) *) -| CPHX : HC08_opcode (* flag = sub (compare H:X) *) -| CPX : HC08_opcode (* flag = sub (compare X) *) -| DAA : HC08_opcode (* decimal adjust A *) -| DBNZ : HC08_opcode (* dec and BNE *) -| DEC : HC08_opcode (* operand=operand-1 (decrement) *) -| DIV : HC08_opcode (* div *) -| EOR : HC08_opcode (* xor *) -| INC : HC08_opcode (* operand=operand+1 (increment) *) -| JMP : HC08_opcode (* jmp word [operand] *) -| JSR : HC08_opcode (* jmp to subroutine *) -| LDA : HC08_opcode (* load in A *) -| LDHX : HC08_opcode (* load in H:X *) -| LDX : HC08_opcode (* load in X *) -| LSR : HC08_opcode (* logical shift right *) -| MOV : HC08_opcode (* move *) -| MUL : HC08_opcode (* mul *) -| NEG : HC08_opcode (* neg (2 complement) *) -| NOP : HC08_opcode (* nop *) -| NSA : HC08_opcode (* nibble swap A (al:ah <- ah:al) *) -| ORA : HC08_opcode (* or *) -| PSHA : HC08_opcode (* push A *) -| PSHH : HC08_opcode (* push H *) -| PSHX : HC08_opcode (* push X *) -| PULA : HC08_opcode (* pop A *) -| PULH : HC08_opcode (* pop H *) -| PULX : HC08_opcode (* pop X *) -| ROL : HC08_opcode (* rotate left *) -| ROR : HC08_opcode (* rotate right *) -| RSP : HC08_opcode (* reset SP (0x00FF) *) -| RTI : HC08_opcode (* return from interrupt *) -| RTS : HC08_opcode (* return from subroutine *) -| SBC : HC08_opcode (* sub with carry*) -| SEC : HC08_opcode (* C=1 *) -| SEI : HC08_opcode (* I=1 *) -| STA : HC08_opcode (* store from A *) -| STHX : HC08_opcode (* store from H:X *) -| STOP : HC08_opcode (* !!stop mode!! *) -| STX : HC08_opcode (* store from X *) -| SUB : HC08_opcode (* sub *) -| SWI : HC08_opcode (* software interrupt *) -| TAP : HC08_opcode (* flag=A (transfer A to process status byte *) -| TAX : HC08_opcode (* X=A (transfer A to X) *) -| TPA : HC08_opcode (* A=flag (transfer process status byte to A) *) -| TST : HC08_opcode (* flag = sub (test) *) -| TSX : HC08_opcode (* X:H=SP (transfer SP to H:X) *) -| TXA : HC08_opcode (* A=X (transfer X to A) *) -| TXS : HC08_opcode (* SP=X:H (transfer H:X to SP) *) -| WAIT : HC08_opcode (* !!wait mode!! *) -. - -ndefinition eq_HC08_op ≝ -λop1,op2:HC08_opcode. - match op1 with - [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ] - | AIS ⇒ match op2 with [ AIS ⇒ true | _ ⇒ false ] | AIX ⇒ match op2 with [ AIX ⇒ true | _ ⇒ false ] - | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ] - | ASR ⇒ match op2 with [ ASR ⇒ true | _ ⇒ false ] | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] - | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ] | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] - | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ] | BGE ⇒ match op2 with [ BGE ⇒ true | _ ⇒ false ] - | BGT ⇒ match op2 with [ BGT ⇒ true | _ ⇒ false ] | BHCC ⇒ match op2 with [ BHCC ⇒ true | _ ⇒ false ] - | BHCS ⇒ match op2 with [ BHCS ⇒ true | _ ⇒ false ] | BHI ⇒ match op2 with [ BHI ⇒ true | _ ⇒ false ] - | BIH ⇒ match op2 with [ BIH ⇒ true | _ ⇒ false ] | BIL ⇒ match op2 with [ BIL ⇒ true | _ ⇒ false ] - | BIT ⇒ match op2 with [ BIT ⇒ true | _ ⇒ false ] | BLE ⇒ match op2 with [ BLE ⇒ true | _ ⇒ false ] - | BLS ⇒ match op2 with [ BLS ⇒ true | _ ⇒ false ] | BLT ⇒ match op2 with [ BLT ⇒ true | _ ⇒ false ] - | BMC ⇒ match op2 with [ BMC ⇒ true | _ ⇒ false ] | BMI ⇒ match op2 with [ BMI ⇒ true | _ ⇒ false ] - | BMS ⇒ match op2 with [ BMS ⇒ true | _ ⇒ false ] | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ] - | BPL ⇒ match op2 with [ BPL ⇒ true | _ ⇒ false ] | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] - | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ] | BRN ⇒ match op2 with [ BRN ⇒ true | _ ⇒ false ] - | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ] - | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] | CBEQA ⇒ match op2 with [ CBEQA ⇒ true | _ ⇒ false ] - | CBEQX ⇒ match op2 with [ CBEQX ⇒ true | _ ⇒ false ] | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] - | CLI ⇒ match op2 with [ CLI ⇒ true | _ ⇒ false ] | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ] - | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ] - | CPHX ⇒ match op2 with [ CPHX ⇒ true | _ ⇒ false ] | CPX ⇒ match op2 with [ CPX ⇒ true | _ ⇒ false ] - | DAA ⇒ match op2 with [ DAA ⇒ true | _ ⇒ false ] | DBNZ ⇒ match op2 with [ DBNZ ⇒ true | _ ⇒ false ] - | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ] | DIV ⇒ match op2 with [ DIV ⇒ true | _ ⇒ false ] - | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ] - | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ] - | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] | LDHX ⇒ match op2 with [ LDHX ⇒ true | _ ⇒ false ] - | LDX ⇒ match op2 with [ LDX ⇒ true | _ ⇒ false ] | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ] - | MOV ⇒ match op2 with [ MOV ⇒ true | _ ⇒ false ] | MUL ⇒ match op2 with [ MUL ⇒ true | _ ⇒ false ] - | NEG ⇒ match op2 with [ NEG ⇒ true | _ ⇒ false ] | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ] - | NSA ⇒ match op2 with [ NSA ⇒ true | _ ⇒ false ] | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] - | PSHA ⇒ match op2 with [ PSHA ⇒ true | _ ⇒ false ] | PSHH ⇒ match op2 with [ PSHH ⇒ true | _ ⇒ false ] - | PSHX ⇒ match op2 with [ PSHX ⇒ true | _ ⇒ false ] | PULA ⇒ match op2 with [ PULA ⇒ true | _ ⇒ false ] - | PULH ⇒ match op2 with [ PULH ⇒ true | _ ⇒ false ] | PULX ⇒ match op2 with [ PULX ⇒ true | _ ⇒ false ] - | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ] | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] - | RSP ⇒ match op2 with [ RSP ⇒ true | _ ⇒ false ] | RTI ⇒ match op2 with [ RTI ⇒ true | _ ⇒ false ] - | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ] | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] - | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ] | SEI ⇒ match op2 with [ SEI ⇒ true | _ ⇒ false ] - | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] | STHX ⇒ match op2 with [ STHX ⇒ true | _ ⇒ false ] - | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ] | STX ⇒ match op2 with [ STX ⇒ true | _ ⇒ false ] - | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] | SWI ⇒ match op2 with [ SWI ⇒ true | _ ⇒ false ] - | TAP ⇒ match op2 with [ TAP ⇒ true | _ ⇒ false ] | TAX ⇒ match op2 with [ TAX ⇒ true | _ ⇒ false ] - | TPA ⇒ match op2 with [ TPA ⇒ true | _ ⇒ false ] | TST ⇒ match op2 with [ TST ⇒ true | _ ⇒ false ] - | TSX ⇒ match op2 with [ TSX ⇒ true | _ ⇒ false ] | TXA ⇒ match op2 with [ TXA ⇒ true | _ ⇒ false ] - | TXS ⇒ match op2 with [ TXS ⇒ true | _ ⇒ false ] | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sugli opcode *) -ndefinition forall_HC08_op ≝ λP:HC08_opcode → bool. - P ADC ⊗ P ADD ⊗ P AIS ⊗ P AIX ⊗ P AND ⊗ P ASL ⊗ P ASR ⊗ P BCC ⊗ - P BCLRn ⊗ P BCS ⊗ P BEQ ⊗ P BGE ⊗ P BGT ⊗ P BHCC ⊗ P BHCS ⊗ P BHI ⊗ - P BIH ⊗ P BIL ⊗ P BIT ⊗ P BLE ⊗ P BLS ⊗ P BLT ⊗ P BMC ⊗ P BMI ⊗ - P BMS ⊗ P BNE ⊗ P BPL ⊗ P BRA ⊗ P BRCLRn ⊗ P BRN ⊗ P BRSETn ⊗ P BSETn ⊗ - P BSR ⊗ P CBEQA ⊗ P CBEQX ⊗ P CLC ⊗ P CLI ⊗ P CLR ⊗ P CMP ⊗ P COM ⊗ - P CPHX ⊗ P CPX ⊗ P DAA ⊗ P DBNZ ⊗ P DEC ⊗ P DIV ⊗ P EOR ⊗ P INC ⊗ - P JMP ⊗ P JSR ⊗ P LDA ⊗ P LDHX ⊗ P LDX ⊗ P LSR ⊗ P MOV ⊗ P MUL ⊗ - P NEG ⊗ P NOP ⊗ P NSA ⊗ P ORA ⊗ P PSHA ⊗ P PSHH ⊗ P PSHX ⊗ P PULA ⊗ - P PULH ⊗ P PULX ⊗ P ROL ⊗ P ROR ⊗ P RSP ⊗ P RTI ⊗ P RTS ⊗ P SBC ⊗ - P SEC ⊗ P SEI ⊗ P STA ⊗ P STHX ⊗ P STOP ⊗ P STX ⊗ P SUB ⊗ P SWI ⊗ - P TAP ⊗ P TAX ⊗ P TPA ⊗ P TST ⊗ P TSX ⊗ P TXA ⊗ P TXS ⊗ P WAIT. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table.ma deleted file mode 100755 index 5ef3c50a1..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table.ma +++ /dev/null @@ -1,475 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/HC08_opcode_base.ma". -include "opcodes/byte_or_word.ma". -include "common/list.ma". - -(* ***************** *) -(* TABELLA DELL'HC08 *) -(* ***************** *) - -(* definizione come concatenazione finale di liste per velocizzare il parsing *) -(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) -(* NB: l'uso di any_opcode m + concatenazione finale tutte liste - impedisce di introdurre opcode disomogenei (per mcu) *) - -ndefinition opcode_table_HC08_1 ≝ -[ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 -; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_2 ≝ -[ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 -; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_3 ≝ -[ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 -; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_4 ≝ -[ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x3〉 -; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_5 ≝ -[ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x3〉 -; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_6 ≝ -[ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 -; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 -; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 -; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 -; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC08_7 ≝ -[ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x4〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x4〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_8 ≝ -[ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_9 ≝ -[ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 -; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_10 ≝ -[ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 -; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) 〈x0,x7〉 -; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) 〈x0,x3〉 -; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) 〈x0,x2〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x7〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x4〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,x9〉 -; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) 〈x0,x2〉 -; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 -; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) 〈x0,x2〉 -; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) 〈x0,x2〉 -; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) 〈x0,x2〉 -; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x1〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x1〉 -; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 -; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 -; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_HC08_11 ≝ -[ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 -; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HC08_12 ≝ -[ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x2〉 -; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 -; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_13 ≝ -[ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 -; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_14 ≝ -[ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x3〉 -; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_15 ≝ -[ - quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 -; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 -; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_16 ≝ -[ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 -; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_17 ≝ -[ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x5〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x3〉 -; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x3〉 -; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x5〉 -; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HC08_18 ≝ -[ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x3〉 -; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_19 ≝ -[ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 -; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_20 ≝ -[ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x3〉 -; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_21 ≝ -[ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x2〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HC08_22 ≝ -[ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x4〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x4〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_23 ≝ -[ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 -; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_24 ≝ -[ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 -; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_25 ≝ -[ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x3〉 -; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_26 ≝ -[ - quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_27 ≝ -[ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x3〉 -; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_28 ≝ -[ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 -; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_29 ≝ -[ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x3〉 -; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_30 ≝ -[ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x3〉 -; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HC08_31 ≝ -[ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 -; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_32 ≝ -[ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 -; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_33 ≝ -[ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 -; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 -; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_34 ≝ -[ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 -; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08_35 ≝ -[ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x2〉 -; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HC08 ≝ -opcode_table_HC08_1 @ opcode_table_HC08_2 @ opcode_table_HC08_3 @ opcode_table_HC08_4 @ -opcode_table_HC08_5 @ opcode_table_HC08_6 @ opcode_table_HC08_7 @ opcode_table_HC08_8 @ -opcode_table_HC08_9 @ opcode_table_HC08_10 @ opcode_table_HC08_11 @ opcode_table_HC08_12 @ -opcode_table_HC08_13 @ opcode_table_HC08_14 @ opcode_table_HC08_15 @ opcode_table_HC08_16 @ -opcode_table_HC08_17 @ opcode_table_HC08_18 @ opcode_table_HC08_19 @ opcode_table_HC08_20 @ -opcode_table_HC08_21 @ opcode_table_HC08_22 @ opcode_table_HC08_23 @ opcode_table_HC08_24 @ -opcode_table_HC08_25 @ opcode_table_HC08_26 @ opcode_table_HC08_27 @ opcode_table_HC08_28 @ -opcode_table_HC08_29 @ opcode_table_HC08_30 @ opcode_table_HC08_31 @ opcode_table_HC08_32 @ -opcode_table_HC08_33 @ opcode_table_HC08_34 @ opcode_table_HC08_35. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table_tests.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table_tests.ma deleted file mode 100755 index c52c6f30c..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HC08_table_tests.ma +++ /dev/null @@ -1,106 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/opcode.ma". - -(* ***************** *) -(* TABELLA DELL'HC08 *) -(* ***************** *) - -(* HC08: opcode non implementati come da manuale (byte) *) -ndefinition HC08_not_impl_byte ≝ - [〈x3,x2〉;〈x3,xE〉 - ;〈x8,x2〉;〈x8,xD〉 - ;〈x9,x6〉;〈x9,xE〉 - ;〈xA,xC〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_byte_table_HC08 : forall_b8 (λb. - (test_not_impl_byte b HC08_not_impl_byte ⊙ eq_w16 (get_byte_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b HC08_not_impl_byte) ⊙ eq_w16 (get_byte_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* HC08: opcode non implementati come da manuale (0x9E+byte) *) -ndefinition HC08_not_impl_word ≝ - [〈x0,x0〉;〈x0,x1〉;〈x0,x2〉;〈x0,x3〉;〈x0,x4〉;〈x0,x5〉;〈x0,x6〉;〈x0,x7〉 - ;〈x0,x8〉;〈x0,x9〉;〈x0,xA〉;〈x0,xB〉;〈x0,xC〉;〈x0,xD〉;〈x0,xE〉;〈x0,xF〉 - ;〈x1,x0〉;〈x1,x1〉;〈x1,x2〉;〈x1,x3〉;〈x1,x4〉;〈x1,x5〉;〈x1,x6〉;〈x1,x7〉 - ;〈x1,x8〉;〈x1,x9〉;〈x1,xA〉;〈x1,xB〉;〈x1,xC〉;〈x1,xD〉;〈x1,xE〉;〈x1,xF〉 - ;〈x2,x0〉;〈x2,x1〉;〈x2,x2〉;〈x2,x3〉;〈x2,x4〉;〈x2,x5〉;〈x2,x6〉;〈x2,x7〉 - ;〈x2,x8〉;〈x2,x9〉;〈x2,xA〉;〈x2,xB〉;〈x2,xC〉;〈x2,xD〉;〈x2,xE〉;〈x2,xF〉 - ;〈x3,x0〉;〈x3,x1〉;〈x3,x2〉;〈x3,x3〉;〈x3,x4〉;〈x3,x5〉;〈x3,x6〉;〈x3,x7〉 - ;〈x3,x8〉;〈x3,x9〉;〈x3,xA〉;〈x3,xB〉;〈x3,xC〉;〈x3,xD〉;〈x3,xE〉;〈x3,xF〉 - ;〈x4,x0〉;〈x4,x1〉;〈x4,x2〉;〈x4,x3〉;〈x4,x4〉;〈x4,x5〉;〈x4,x6〉;〈x4,x7〉 - ;〈x4,x8〉;〈x4,x9〉;〈x4,xA〉;〈x4,xB〉;〈x4,xC〉;〈x4,xD〉;〈x4,xE〉;〈x4,xF〉 - ;〈x5,x0〉;〈x5,x1〉;〈x5,x2〉;〈x5,x3〉;〈x5,x4〉;〈x5,x5〉;〈x5,x6〉;〈x5,x7〉 - ;〈x5,x8〉;〈x5,x9〉;〈x5,xA〉;〈x5,xB〉;〈x5,xC〉;〈x5,xD〉;〈x5,xE〉;〈x5,xF〉 - ;〈x6,x2〉;〈x6,x5〉;〈x6,xE〉 - ;〈x7,x0〉;〈x7,x1〉;〈x7,x2〉;〈x7,x3〉;〈x7,x4〉;〈x7,x5〉;〈x7,x6〉;〈x7,x7〉 - ;〈x7,x8〉;〈x7,x9〉;〈x7,xA〉;〈x7,xB〉;〈x7,xC〉;〈x7,xD〉;〈x7,xE〉;〈x7,xF〉 - ;〈x8,x0〉;〈x8,x1〉;〈x8,x2〉;〈x8,x3〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉 - ;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉;〈x8,xE〉;〈x8,xF〉 - ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,x7〉 - ;〈x9,x8〉;〈x9,x9〉;〈x9,xA〉;〈x9,xB〉;〈x9,xC〉;〈x9,xD〉;〈x9,xE〉;〈x9,xF〉 - ;〈xA,x0〉;〈xA,x1〉;〈xA,x2〉;〈xA,x3〉;〈xA,x4〉;〈xA,x5〉;〈xA,x6〉;〈xA,x7〉 - ;〈xA,x8〉;〈xA,x9〉;〈xA,xA〉;〈xA,xB〉;〈xA,xC〉;〈xA,xD〉;〈xA,xE〉;〈xA,xF〉 - ;〈xB,x0〉;〈xB,x1〉;〈xB,x2〉;〈xB,x3〉;〈xB,x4〉;〈xB,x5〉;〈xB,x6〉;〈xB,x7〉 - ;〈xB,x8〉;〈xB,x9〉;〈xB,xA〉;〈xB,xB〉;〈xB,xC〉;〈xB,xD〉;〈xB,xE〉;〈xB,xF〉 - ;〈xC,x0〉;〈xC,x1〉;〈xC,x2〉;〈xC,x3〉;〈xC,x4〉;〈xC,x5〉;〈xC,x6〉;〈xC,x7〉 - ;〈xC,x8〉;〈xC,x9〉;〈xC,xA〉;〈xC,xB〉;〈xC,xC〉;〈xC,xD〉;〈xC,xE〉;〈xC,xF〉 - ;〈xD,xC〉;〈xD,xD〉 - ;〈xE,xC〉;〈xE,xD〉 - ;〈xF,x0〉;〈xF,x1〉;〈xF,x2〉;〈xF,x3〉;〈xF,x4〉;〈xF,x5〉;〈xF,x6〉;〈xF,x7〉 - ;〈xF,x8〉;〈xF,x9〉;〈xF,xA〉;〈xF,xB〉;〈xF,xC〉;〈xF,xD〉;〈xF,xE〉;〈xF,xF〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_word_table_HC08 : forall_b8 (λb. - (test_not_impl_byte b HC08_not_impl_word ⊙ eq_w16 (get_word_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b HC08_not_impl_word) ⊙ eq_w16 (get_word_count HC08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* tutti op implementati *) -nlemma ok_pseudo_table_HC08 : - forall_op HC08 (λo. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) = true. - napply refl_eq. -nqed. - -(* tutte im implementate *) -nlemma ok_mode_table_HC08 : - forall_im HC08 (λi. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) = true. - napply refl_eq. -nqed. - -(* nessuna ripetizione di combinazione op + imm *) -nlemma ok_OpIm_table_HC08 : - forall_im HC08 (λi. - forall_op HC08 (λo. - le_w16 (get_OpIm_count HC08 o i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_opcode_base.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_opcode_base.ma deleted file mode 100755 index b2962f6cb..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_opcode_base.ma +++ /dev/null @@ -1,333 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* ********************************************** *) -(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) -(* ********************************************** *) - -(* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *) -ninductive HCS08_instr_mode: Type ≝ - (* INHERENT = nessun operando *) - MODE_INH : HCS08_instr_mode - (* INHERENT = nessun operando (A implicito) *) -| MODE_INHA : HCS08_instr_mode - (* INHERENT = nessun operando (X implicito) *) -| MODE_INHX : HCS08_instr_mode - (* INHERENT = nessun operando (H implicito) *) -| MODE_INHH : HCS08_instr_mode - - (* INHERENT_ADDRESS = nessun operando (HX implicito) *) -| MODE_INHX0ADD : HCS08_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0x00bb) *) -| MODE_INHX1ADD : HCS08_instr_mode - (* INHERENT_ADDRESS = nessun operando (HX implicito+0xwwww) *) -| MODE_INHX2ADD : HCS08_instr_mode - - (* IMMEDIATE = operando valore immediato byte = 0xbb *) -| MODE_IMM1 : HCS08_instr_mode - (* IMMEDIATE_EXT = operando valore immediato byte = 0xbb -> esteso a word *) -| MODE_IMM1EXT : HCS08_instr_mode - (* IMMEDIATE = operando valore immediato word = 0xwwww *) -| MODE_IMM2 : HCS08_instr_mode - (* DIRECT = operando offset byte = [0x00bb] *) -| MODE_DIR1 : HCS08_instr_mode - (* DIRECT = operando offset word = [0xwwww] *) -| MODE_DIR2 : HCS08_instr_mode - (* INDEXED = nessun operando (implicito [X] *) -| MODE_IX0 : HCS08_instr_mode - (* INDEXED = operando offset relativo byte = [X+0x00bb] *) -| MODE_IX1 : HCS08_instr_mode - (* INDEXED = operando offset relativo word = [X+0xwwww] *) -| MODE_IX2 : HCS08_instr_mode - (* INDEXED = operando offset relativo byte = [SP+0x00bb] *) -| MODE_SP1 : HCS08_instr_mode - (* INDEXED = operando offset relativo word = [SP+0xwwww] *) -| MODE_SP2 : HCS08_instr_mode - - (* DIRECT → DIRECT = carica da diretto/scrive su diretto *) -| MODE_DIR1_to_DIR1 : HCS08_instr_mode - (* IMMEDIATE → DIRECT = carica da immediato/scrive su diretto *) -| MODE_IMM1_to_DIR1 : HCS08_instr_mode - (* INDEXED++ → DIRECT = carica da [X]/scrive su diretto/H:X++ *) -| MODE_IX0p_to_DIR1 : HCS08_instr_mode - (* DIRECT → INDEXED++ = carica da diretto/scrive su [X]/H:X++ *) -| MODE_DIR1_to_IX0p : HCS08_instr_mode - - (* INHERENT(A) + IMMEDIATE *) -| MODE_INHA_and_IMM1 : HCS08_instr_mode - (* INHERENT(X) + IMMEDIATE *) -| MODE_INHX_and_IMM1 : HCS08_instr_mode - (* IMMEDIATE + IMMEDIATE *) -| MODE_IMM1_and_IMM1 : HCS08_instr_mode - (* DIRECT + IMMEDIATE *) -| MODE_DIR1_and_IMM1 : HCS08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_IX0_and_IMM1 : HCS08_instr_mode - (* INDEXED++ + IMMEDIATE *) -| MODE_IX0p_and_IMM1 : HCS08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_IX1_and_IMM1 : HCS08_instr_mode - (* INDEXED++ + IMMEDIATE *) -| MODE_IX1p_and_IMM1 : HCS08_instr_mode - (* INDEXED + IMMEDIATE *) -| MODE_SP1_and_IMM1 : HCS08_instr_mode - - (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *) - (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *) -| MODE_DIRn : oct → HCS08_instr_mode - (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *) - (* + operando valore immediato byte *) - (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *) -| MODE_DIRn_and_IMM1 : oct → HCS08_instr_mode -. - -ndefinition eq_HCS08_im ≝ -λi1,i2:HCS08_instr_mode. - match i1 with - [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ] - | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ true | _ ⇒ false ] - | MODE_INHX ⇒ match i2 with [ MODE_INHX ⇒ true | _ ⇒ false ] - | MODE_INHH ⇒ match i2 with [ MODE_INHH ⇒ true | _ ⇒ false ] - | MODE_INHX0ADD ⇒ match i2 with [ MODE_INHX0ADD ⇒ true | _ ⇒ false ] - | MODE_INHX1ADD ⇒ match i2 with [ MODE_INHX1ADD ⇒ true | _ ⇒ false ] - | MODE_INHX2ADD ⇒ match i2 with [ MODE_INHX2ADD ⇒ true | _ ⇒ false ] - | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1EXT ⇒ match i2 with [ MODE_IMM1EXT ⇒ true | _ ⇒ false ] - | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ true | _ ⇒ false ] - | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR2 ⇒ match i2 with [ MODE_DIR2 ⇒ true | _ ⇒ false ] - | MODE_IX0 ⇒ match i2 with [ MODE_IX0 ⇒ true | _ ⇒ false ] - | MODE_IX1 ⇒ match i2 with [ MODE_IX1 ⇒ true | _ ⇒ false ] - | MODE_IX2 ⇒ match i2 with [ MODE_IX2 ⇒ true | _ ⇒ false ] - | MODE_SP1 ⇒ match i2 with [ MODE_SP1 ⇒ true | _ ⇒ false ] - | MODE_SP2 ⇒ match i2 with [ MODE_SP2 ⇒ true | _ ⇒ false ] - | MODE_DIR1_to_DIR1 ⇒ match i2 with [ MODE_DIR1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_to_DIR1 ⇒ match i2 with [ MODE_IMM1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_IX0p_to_DIR1 ⇒ match i2 with [ MODE_IX0p_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_to_IX0p ⇒ match i2 with [ MODE_DIR1_to_IX0p ⇒ true | _ ⇒ false ] - | MODE_INHA_and_IMM1 ⇒ match i2 with [ MODE_INHA_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_INHX_and_IMM1 ⇒ match i2 with [ MODE_INHX_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_and_IMM1 ⇒ match i2 with [ MODE_IMM1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_and_IMM1 ⇒ match i2 with [ MODE_DIR1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX0_and_IMM1 ⇒ match i2 with [ MODE_IX0_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX0p_and_IMM1 ⇒ match i2 with [ MODE_IX0p_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX1_and_IMM1 ⇒ match i2 with [ MODE_IX1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IX1p_and_IMM1 ⇒ match i2 with [ MODE_IX1p_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_SP1_and_IMM1 ⇒ match i2 with [ MODE_SP1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIRn n1 ⇒ match i2 with [ MODE_DIRn n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with [ MODE_DIRn_and_IMM1 n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - ]. - -(* iteratore sulle modalita' *) -ndefinition forall_HCS08_im ≝ λP:HCS08_instr_mode → bool. - P MODE_INH -⊗ P MODE_INHA -⊗ P MODE_INHX -⊗ P MODE_INHH -⊗ P MODE_INHX0ADD -⊗ P MODE_INHX1ADD -⊗ P MODE_INHX2ADD -⊗ P MODE_IMM1 -⊗ P MODE_IMM1EXT -⊗ P MODE_IMM2 -⊗ P MODE_DIR1 -⊗ P MODE_DIR2 -⊗ P MODE_IX0 -⊗ P MODE_IX1 -⊗ P MODE_IX2 -⊗ P MODE_SP1 -⊗ P MODE_SP2 -⊗ P MODE_DIR1_to_DIR1 -⊗ P MODE_IMM1_to_DIR1 -⊗ P MODE_IX0p_to_DIR1 -⊗ P MODE_DIR1_to_IX0p -⊗ P MODE_INHA_and_IMM1 -⊗ P MODE_INHX_and_IMM1 -⊗ P MODE_IMM1_and_IMM1 -⊗ P MODE_DIR1_and_IMM1 -⊗ P MODE_IX0_and_IMM1 -⊗ P MODE_IX0p_and_IMM1 -⊗ P MODE_IX1_and_IMM1 -⊗ P MODE_IX1p_and_IMM1 -⊗ P MODE_SP1_and_IMM1 -⊗ forall_oct (λo. P (MODE_DIRn o)) -⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o)). - -(* enumerazione delle istruzioni *) -ninductive HCS08_opcode: Type ≝ - ADC : HCS08_opcode (* add with carry *) -| ADD : HCS08_opcode (* add *) -| AIS : HCS08_opcode (* add immediate to SP *) -| AIX : HCS08_opcode (* add immediate to X *) -| AND : HCS08_opcode (* and *) -| ASL : HCS08_opcode (* aritmetic shift left *) -| ASR : HCS08_opcode (* aritmetic shift right *) -| BCC : HCS08_opcode (* branch if C=0 *) -| BCLRn : HCS08_opcode (* clear bit n *) -| BCS : HCS08_opcode (* branch if C=1 *) -| BEQ : HCS08_opcode (* branch if Z=1 *) -| BGE : HCS08_opcode (* branch if N⊙V=0 (great or equal) *) -| BGND : HCS08_opcode (* !!background mode!! *) -| BGT : HCS08_opcode (* branch if Z|N⊙V=0 clear (great) *) -| BHCC : HCS08_opcode (* branch if H=0 *) -| BHCS : HCS08_opcode (* branch if H=1 *) -| BHI : HCS08_opcode (* branch if C|Z=0, (higher) *) -| BIH : HCS08_opcode (* branch if nIRQ=1 *) -| BIL : HCS08_opcode (* branch if nIRQ=0 *) -| BIT : HCS08_opcode (* flag = and (bit test) *) -| BLE : HCS08_opcode (* branch if Z|N⊙V=1 (less or equal) *) -| BLS : HCS08_opcode (* branch if C|Z=1 (lower or same) *) -| BLT : HCS08_opcode (* branch if N⊙1=1 (less) *) -| BMC : HCS08_opcode (* branch if I=0 (interrupt mask clear) *) -| BMI : HCS08_opcode (* branch if N=1 (minus) *) -| BMS : HCS08_opcode (* branch if I=1 (interrupt mask set) *) -| BNE : HCS08_opcode (* branch if Z=0 *) -| BPL : HCS08_opcode (* branch if N=0 (plus) *) -| BRA : HCS08_opcode (* branch always *) -| BRCLRn : HCS08_opcode (* branch if bit n clear *) -| BRN : HCS08_opcode (* branch never (nop) *) -| BRSETn : HCS08_opcode (* branch if bit n set *) -| BSETn : HCS08_opcode (* set bit n *) -| BSR : HCS08_opcode (* branch to subroutine *) -| CBEQA : HCS08_opcode (* compare (A) and BEQ *) -| CBEQX : HCS08_opcode (* compare (X) and BEQ *) -| CLC : HCS08_opcode (* C=0 *) -| CLI : HCS08_opcode (* I=0 *) -| CLR : HCS08_opcode (* operand=0 *) -| CMP : HCS08_opcode (* flag = sub (compare A) *) -| COM : HCS08_opcode (* not (1 complement) *) -| CPHX : HCS08_opcode (* flag = sub (compare H:X) *) -| CPX : HCS08_opcode (* flag = sub (compare X) *) -| DAA : HCS08_opcode (* decimal adjust A *) -| DBNZ : HCS08_opcode (* dec and BNE *) -| DEC : HCS08_opcode (* operand=operand-1 (decrement) *) -| DIV : HCS08_opcode (* div *) -| EOR : HCS08_opcode (* xor *) -| INC : HCS08_opcode (* operand=operand+1 (increment) *) -| JMP : HCS08_opcode (* jmp word [operand] *) -| JSR : HCS08_opcode (* jmp to subroutine *) -| LDA : HCS08_opcode (* load in A *) -| LDHX : HCS08_opcode (* load in H:X *) -| LDX : HCS08_opcode (* load in X *) -| LSR : HCS08_opcode (* logical shift right *) -| MOV : HCS08_opcode (* move *) -| MUL : HCS08_opcode (* mul *) -| NEG : HCS08_opcode (* neg (2 complement) *) -| NOP : HCS08_opcode (* nop *) -| NSA : HCS08_opcode (* nibble swap A (al:ah <- ah:al) *) -| ORA : HCS08_opcode (* or *) -| PSHA : HCS08_opcode (* push A *) -| PSHH : HCS08_opcode (* push H *) -| PSHX : HCS08_opcode (* push X *) -| PULA : HCS08_opcode (* pop A *) -| PULH : HCS08_opcode (* pop H *) -| PULX : HCS08_opcode (* pop X *) -| ROL : HCS08_opcode (* rotate left *) -| ROR : HCS08_opcode (* rotate right *) -| RSP : HCS08_opcode (* reset SP (0x00FF) *) -| RTI : HCS08_opcode (* return from interrupt *) -| RTS : HCS08_opcode (* return from subroutine *) -| SBC : HCS08_opcode (* sub with carry*) -| SEC : HCS08_opcode (* C=1 *) -| SEI : HCS08_opcode (* I=1 *) -| STA : HCS08_opcode (* store from A *) -| STHX : HCS08_opcode (* store from H:X *) -| STOP : HCS08_opcode (* !!stop mode!! *) -| STX : HCS08_opcode (* store from X *) -| SUB : HCS08_opcode (* sub *) -| SWI : HCS08_opcode (* software interrupt *) -| TAP : HCS08_opcode (* flag=A (transfer A to process status byte *) -| TAX : HCS08_opcode (* X=A (transfer A to X) *) -| TPA : HCS08_opcode (* A=flag (transfer process status byte to A) *) -| TST : HCS08_opcode (* flag = sub (test) *) -| TSX : HCS08_opcode (* X:H=SP (transfer SP to H:X) *) -| TXA : HCS08_opcode (* A=X (transfer X to A) *) -| TXS : HCS08_opcode (* SP=X:H (transfer H:X to SP) *) -| WAIT : HCS08_opcode (* !!wait mode!! *) -. - -ndefinition eq_HCS08_op ≝ -λop1,op2:HCS08_opcode. - match op1 with - [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ] - | AIS ⇒ match op2 with [ AIS ⇒ true | _ ⇒ false ] | AIX ⇒ match op2 with [ AIX ⇒ true | _ ⇒ false ] - | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ] - | ASR ⇒ match op2 with [ ASR ⇒ true | _ ⇒ false ] | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] - | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ] | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] - | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ] | BGE ⇒ match op2 with [ BGE ⇒ true | _ ⇒ false ] - | BGND ⇒ match op2 with [ BGND ⇒ true | _ ⇒ false ] | BGT ⇒ match op2 with [ BGT ⇒ true | _ ⇒ false ] - | BHCC ⇒ match op2 with [ BHCC ⇒ true | _ ⇒ false ] | BHCS ⇒ match op2 with [ BHCS ⇒ true | _ ⇒ false ] - | BHI ⇒ match op2 with [ BHI ⇒ true | _ ⇒ false ] | BIH ⇒ match op2 with [ BIH ⇒ true | _ ⇒ false ] - | BIL ⇒ match op2 with [ BIL ⇒ true | _ ⇒ false ] | BIT ⇒ match op2 with [ BIT ⇒ true | _ ⇒ false ] - | BLE ⇒ match op2 with [ BLE ⇒ true | _ ⇒ false ] | BLS ⇒ match op2 with [ BLS ⇒ true | _ ⇒ false ] - | BLT ⇒ match op2 with [ BLT ⇒ true | _ ⇒ false ] | BMC ⇒ match op2 with [ BMC ⇒ true | _ ⇒ false ] - | BMI ⇒ match op2 with [ BMI ⇒ true | _ ⇒ false ] | BMS ⇒ match op2 with [ BMS ⇒ true | _ ⇒ false ] - | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ] | BPL ⇒ match op2 with [ BPL ⇒ true | _ ⇒ false ] - | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ] - | BRN ⇒ match op2 with [ BRN ⇒ true | _ ⇒ false ] | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] - | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ] | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] - | CBEQA ⇒ match op2 with [ CBEQA ⇒ true | _ ⇒ false ] | CBEQX ⇒ match op2 with [ CBEQX ⇒ true | _ ⇒ false ] - | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] | CLI ⇒ match op2 with [ CLI ⇒ true | _ ⇒ false ] - | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ] | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] - | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ] | CPHX ⇒ match op2 with [ CPHX ⇒ true | _ ⇒ false ] - | CPX ⇒ match op2 with [ CPX ⇒ true | _ ⇒ false ] | DAA ⇒ match op2 with [ DAA ⇒ true | _ ⇒ false ] - | DBNZ ⇒ match op2 with [ DBNZ ⇒ true | _ ⇒ false ] | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ] - | DIV ⇒ match op2 with [ DIV ⇒ true | _ ⇒ false ] | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] - | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ] | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] - | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ] | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] - | LDHX ⇒ match op2 with [ LDHX ⇒ true | _ ⇒ false ] | LDX ⇒ match op2 with [ LDX ⇒ true | _ ⇒ false ] - | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ] | MOV ⇒ match op2 with [ MOV ⇒ true | _ ⇒ false ] - | MUL ⇒ match op2 with [ MUL ⇒ true | _ ⇒ false ] | NEG ⇒ match op2 with [ NEG ⇒ true | _ ⇒ false ] - | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ] | NSA ⇒ match op2 with [ NSA ⇒ true | _ ⇒ false ] - | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] | PSHA ⇒ match op2 with [ PSHA ⇒ true | _ ⇒ false ] - | PSHH ⇒ match op2 with [ PSHH ⇒ true | _ ⇒ false ] | PSHX ⇒ match op2 with [ PSHX ⇒ true | _ ⇒ false ] - | PULA ⇒ match op2 with [ PULA ⇒ true | _ ⇒ false ] | PULH ⇒ match op2 with [ PULH ⇒ true | _ ⇒ false ] - | PULX ⇒ match op2 with [ PULX ⇒ true | _ ⇒ false ] | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ] - | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] | RSP ⇒ match op2 with [ RSP ⇒ true | _ ⇒ false ] - | RTI ⇒ match op2 with [ RTI ⇒ true | _ ⇒ false ] | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ] - | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ] - | SEI ⇒ match op2 with [ SEI ⇒ true | _ ⇒ false ] | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] - | STHX ⇒ match op2 with [ STHX ⇒ true | _ ⇒ false ] | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ] - | STX ⇒ match op2 with [ STX ⇒ true | _ ⇒ false ] | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] - | SWI ⇒ match op2 with [ SWI ⇒ true | _ ⇒ false ] | TAP ⇒ match op2 with [ TAP ⇒ true | _ ⇒ false ] - | TAX ⇒ match op2 with [ TAX ⇒ true | _ ⇒ false ] | TPA ⇒ match op2 with [ TPA ⇒ true | _ ⇒ false ] - | TST ⇒ match op2 with [ TST ⇒ true | _ ⇒ false ] | TSX ⇒ match op2 with [ TSX ⇒ true | _ ⇒ false ] - | TXA ⇒ match op2 with [ TXA ⇒ true | _ ⇒ false ] | TXS ⇒ match op2 with [ TXS ⇒ true | _ ⇒ false ] - | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sugli opcode *) -ndefinition forall_HCS08_op ≝ λP:HCS08_opcode → bool. - P ADC ⊗ P ADD ⊗ P AIS ⊗ P AIX ⊗ P AND ⊗ P ASL ⊗ P ASR ⊗ P BCC ⊗ - P BCLRn ⊗ P BCS ⊗ P BEQ ⊗ P BGE ⊗ P BGND ⊗ P BGT ⊗ P BHCC ⊗ P BHCS ⊗ - P BHI ⊗ P BIH ⊗ P BIL ⊗ P BIT ⊗ P BLE ⊗ P BLS ⊗ P BLT ⊗ P BMC ⊗ - P BMI ⊗ P BMS ⊗ P BNE ⊗ P BPL ⊗ P BRA ⊗ P BRCLRn ⊗ P BRN ⊗ P BRSETn ⊗ - P BSETn ⊗ P BSR ⊗ P CBEQA ⊗ P CBEQX ⊗ P CLC ⊗ P CLI ⊗ P CLR ⊗ P CMP ⊗ - P COM ⊗ P CPHX ⊗ P CPX ⊗ P DAA ⊗ P DBNZ ⊗ P DEC ⊗ P DIV ⊗ P EOR ⊗ - P INC ⊗ P JMP ⊗ P JSR ⊗ P LDA ⊗ P LDHX ⊗ P LDX ⊗ P LSR ⊗ P MOV ⊗ - P MUL ⊗ P NEG ⊗ P NOP ⊗ P NSA ⊗ P ORA ⊗ P PSHA ⊗ P PSHH ⊗ P PSHX ⊗ - P PULA ⊗ P PULH ⊗ P PULX ⊗ P ROL ⊗ P ROR ⊗ P RSP ⊗ P RTI ⊗ P RTS ⊗ - P SBC ⊗ P SEC ⊗ P SEI ⊗ P STA ⊗ P STHX ⊗ P STOP ⊗ P STX ⊗ P SUB ⊗ - P SWI ⊗ P TAP ⊗ P TAX ⊗ P TPA ⊗ P TST ⊗ P TSX ⊗ P TXA ⊗ P TXS ⊗ - P WAIT. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table.ma deleted file mode 100755 index 41ba5d7bd..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table.ma +++ /dev/null @@ -1,487 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/HCS08_opcode_base.ma". -include "opcodes/byte_or_word.ma". -include "common/list.ma". - -(* ****************** *) -(* TABELLA DELL'HCS08 *) -(* ****************** *) - -(* definizione come concatenazione finale di liste per velocizzare il parsing *) -(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) -(* NB: l'uso di any_opcode m + concatenazione finale tutte liste - impedisce di introdurre opcode disomogenei (per mcu) *) - -ndefinition opcode_table_HCS08_1 ≝ -[ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_DIR2 (Byte 〈xC,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX2 (Byte 〈xD,x9〉) 〈x0,x4〉 -; quadruple … ADC MODE_IX1 (Byte 〈xE,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_IX0 (Byte 〈xF,x9〉) 〈x0,x3〉 -; quadruple … ADC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x9〉〉) 〈x0,x5〉 -; quadruple … ADC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x9〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_2 ≝ -[ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_DIR2 (Byte 〈xC,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX2 (Byte 〈xD,xB〉) 〈x0,x4〉 -; quadruple … ADD MODE_IX1 (Byte 〈xE,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_IX0 (Byte 〈xF,xB〉) 〈x0,x3〉 -; quadruple … ADD MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xB〉〉) 〈x0,x5〉 -; quadruple … ADD MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xB〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_3 ≝ -[ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_DIR2 (Byte 〈xC,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX2 (Byte 〈xD,x4〉) 〈x0,x4〉 -; quadruple … AND MODE_IX1 (Byte 〈xE,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_IX0 (Byte 〈xF,x4〉) 〈x0,x3〉 -; quadruple … AND MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x4〉〉) 〈x0,x5〉 -; quadruple … AND MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x4〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_4 ≝ -[ - quadruple … ASL MODE_DIR1 (Byte 〈x3,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_INHX (Byte 〈x5,x8〉) 〈x0,x1〉 -; quadruple … ASL MODE_IX1 (Byte 〈x6,x8〉) 〈x0,x5〉 -; quadruple … ASL MODE_IX0 (Byte 〈x7,x8〉) 〈x0,x4〉 -; quadruple … ASL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x8〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_5 ≝ -[ - quadruple … ASR MODE_DIR1 (Byte 〈x3,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_INHA (Byte 〈x4,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_INHX (Byte 〈x5,x7〉) 〈x0,x1〉 -; quadruple … ASR MODE_IX1 (Byte 〈x6,x7〉) 〈x0,x5〉 -; quadruple … ASR MODE_IX0 (Byte 〈x7,x7〉) 〈x0,x4〉 -; quadruple … ASR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x7〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_6 ≝ -[ - quadruple … BRA MODE_IMM1 (Byte 〈x2,x0〉) 〈x0,x3〉 -; quadruple … BRN MODE_IMM1 (Byte 〈x2,x1〉) 〈x0,x3〉 -; quadruple … BHI MODE_IMM1 (Byte 〈x2,x2〉) 〈x0,x3〉 -; quadruple … BLS MODE_IMM1 (Byte 〈x2,x3〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x2,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x2,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x2,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x2,x7〉) 〈x0,x3〉 -; quadruple … BHCC MODE_IMM1 (Byte 〈x2,x8〉) 〈x0,x3〉 -; quadruple … BHCS MODE_IMM1 (Byte 〈x2,x9〉) 〈x0,x3〉 -; quadruple … BPL MODE_IMM1 (Byte 〈x2,xA〉) 〈x0,x3〉 -; quadruple … BMI MODE_IMM1 (Byte 〈x2,xB〉) 〈x0,x3〉 -; quadruple … BMC MODE_IMM1 (Byte 〈x2,xC〉) 〈x0,x3〉 -; quadruple … BMS MODE_IMM1 (Byte 〈x2,xD〉) 〈x0,x3〉 -; quadruple … BIL MODE_IMM1 (Byte 〈x2,xE〉) 〈x0,x3〉 -; quadruple … BIH MODE_IMM1 (Byte 〈x2,xF〉) 〈x0,x3〉 -; quadruple … BGE MODE_IMM1 (Byte 〈x9,x0〉) 〈x0,x3〉 -; quadruple … BLT MODE_IMM1 (Byte 〈x9,x1〉) 〈x0,x3〉 -; quadruple … BGT MODE_IMM1 (Byte 〈x9,x2〉) 〈x0,x3〉 -; quadruple … BLE MODE_IMM1 (Byte 〈x9,x3〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HCS08_7 ≝ -[ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08_8 ≝ -[ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08_9 ≝ -[ - quadruple … BIT MODE_IMM1 (Byte 〈xA,x5〉) 〈x0,x2〉 -; quadruple … BIT MODE_DIR1 (Byte 〈xB,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_DIR2 (Byte 〈xC,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX2 (Byte 〈xD,x5〉) 〈x0,x4〉 -; quadruple … BIT MODE_IX1 (Byte 〈xE,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_IX0 (Byte 〈xF,x5〉) 〈x0,x3〉 -; quadruple … BIT MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x5〉〉) 〈x0,x5〉 -; quadruple … BIT MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x5〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_10 ≝ -[ - quadruple … MUL MODE_INH (Byte 〈x4,x2〉) 〈x0,x5〉 -; quadruple … DIV MODE_INH (Byte 〈x5,x2〉) 〈x0,x6〉 -; quadruple … NSA MODE_INH (Byte 〈x6,x2〉) 〈x0,x1〉 -; quadruple … DAA MODE_INH (Byte 〈x7,x2〉) 〈x0,x1〉 -; quadruple … RTI MODE_INH (Byte 〈x8,x0〉) 〈x0,x9〉 -; quadruple … RTS MODE_INH (Byte 〈x8,x1〉) 〈x0,x6〉 -; quadruple … SWI MODE_INH (Byte 〈x8,x3〉) 〈x0,xB〉 -; quadruple … BGND MODE_INH (Byte 〈x8,x2〉) 〈x0,x5〉 -; quadruple … TAP MODE_INH (Byte 〈x8,x4〉) 〈x0,x1〉 -; quadruple … TPA MODE_INH (Byte 〈x8,x5〉) 〈x0,x1〉 -; quadruple … PULA MODE_INH (Byte 〈x8,x6〉) 〈x0,x3〉 -; quadruple … PSHA MODE_INH (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … PULX MODE_INH (Byte 〈x8,x8〉) 〈x0,x3〉 -; quadruple … PSHX MODE_INH (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … PULH MODE_INH (Byte 〈x8,xA〉) 〈x0,x3〉 -; quadruple … PSHH MODE_INH (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … STOP MODE_INH (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … TXS MODE_INH (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … TSX MODE_INH (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … TAX MODE_INH (Byte 〈x9,x7〉) 〈x0,x1〉 -; quadruple … CLC MODE_INH (Byte 〈x9,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x9,x9〉) 〈x0,x1〉 -; quadruple … CLI MODE_INH (Byte 〈x9,xA〉) 〈x0,x1〉 -; quadruple … SEI MODE_INH (Byte 〈x9,xB〉) 〈x0,x1〉 -; quadruple … RSP MODE_INH (Byte 〈x9,xC〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈x9,xD〉) 〈x0,x1〉 -; quadruple … TXA MODE_INH (Byte 〈x9,xF〉) 〈x0,x1〉 -; quadruple … AIS MODE_IMM1 (Byte 〈xA,x7〉) 〈x0,x2〉 -; quadruple … AIX MODE_IMM1 (Byte 〈xA,xF〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_HCS08_11 ≝ -[ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 -; quadruple … CBEQX MODE_IMM1_and_IMM1 (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … CBEQA MODE_IX1p_and_IMM1 (Byte 〈x6,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IX0p_and_IMM1 (Byte 〈x7,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,x1〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_12 ≝ -[ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_INHX (Byte 〈x5,xF〉) 〈x0,x1〉 -; quadruple … CLR MODE_IX1 (Byte 〈x6,xF〉) 〈x0,x5〉 -; quadruple … CLR MODE_IX0 (Byte 〈x7,xF〉) 〈x0,x4〉 -; quadruple … CLR MODE_INHH (Byte 〈x8,xC〉) 〈x0,x1〉 -; quadruple … CLR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xF〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_13 ≝ -[ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_DIR2 (Byte 〈xC,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX2 (Byte 〈xD,x1〉) 〈x0,x4〉 -; quadruple … CMP MODE_IX1 (Byte 〈xE,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_IX0 (Byte 〈xF,x1〉) 〈x0,x3〉 -; quadruple … CMP MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x1〉〉) 〈x0,x5〉 -; quadruple … CMP MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x1〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_14 ≝ -[ - quadruple … COM MODE_DIR1 (Byte 〈x3,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_INHX (Byte 〈x5,x3〉) 〈x0,x1〉 -; quadruple … COM MODE_IX1 (Byte 〈x6,x3〉) 〈x0,x5〉 -; quadruple … COM MODE_IX0 (Byte 〈x7,x3〉) 〈x0,x4〉 -; quadruple … COM MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x3〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_15 ≝ -[ - quadruple … CPHX MODE_DIR2 (Byte 〈x3,xE〉) 〈x0,x6〉 -; quadruple … CPHX MODE_IMM2 (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … CPHX MODE_DIR1 (Byte 〈x7,x5〉) 〈x0,x5〉 -; quadruple … CPHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,x3〉〉) 〈x0,x6〉 - -; quadruple … LDHX MODE_DIR2 (Byte 〈x3,x2〉) 〈x0,x5〉 -; quadruple … LDHX MODE_IMM2 (Byte 〈x4,x5〉) 〈x0,x3〉 -; quadruple … LDHX MODE_DIR1 (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … LDHX MODE_IX0 (Word 〈〈x9,xE〉:〈xA,xE〉〉) 〈x0,x5〉 -; quadruple … LDHX MODE_IX2 (Word 〈〈x9,xE〉:〈xB,xE〉〉) 〈x0,x6〉 -; quadruple … LDHX MODE_IX1 (Word 〈〈x9,xE〉:〈xC,xE〉〉) 〈x0,x5〉 -; quadruple … LDHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xE〉〉) 〈x0,x5〉 - -; quadruple … STHX MODE_DIR1 (Byte 〈x3,x5〉) 〈x0,x4〉 -; quadruple … STHX MODE_DIR2 (Byte 〈x9,x6〉) 〈x0,x5〉 -; quadruple … STHX MODE_SP1 (Word 〈〈x9,xE〉:〈xF,xF〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08_16 ≝ -[ - quadruple … CPX MODE_IMM1 (Byte 〈xA,x3〉) 〈x0,x2〉 -; quadruple … CPX MODE_DIR1 (Byte 〈xB,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_DIR2 (Byte 〈xC,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX2 (Byte 〈xD,x3〉) 〈x0,x4〉 -; quadruple … CPX MODE_IX1 (Byte 〈xE,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_IX0 (Byte 〈xF,x3〉) 〈x0,x3〉 -; quadruple … CPX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x3〉〉) 〈x0,x5〉 -; quadruple … CPX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x3〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_17 ≝ -[ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_INHX_and_IMM1 (Byte 〈x5,xB〉) 〈x0,x4〉 -; quadruple … DBNZ MODE_IX1_and_IMM1 (Byte 〈x6,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_IX0_and_IMM1 (Byte 〈x7,xB〉) 〈x0,x6〉 -; quadruple … DBNZ MODE_SP1_and_IMM1 (Word 〈〈x9,xE〉:〈x6,xB〉〉) 〈x0,x8〉 -]. - -ndefinition opcode_table_HCS08_18 ≝ -[ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_INHX (Byte 〈x5,xA〉) 〈x0,x1〉 -; quadruple … DEC MODE_IX1 (Byte 〈x6,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_IX0 (Byte 〈x7,xA〉) 〈x0,x4〉 -; quadruple … DEC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xA〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_19 ≝ -[ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_DIR2 (Byte 〈xC,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX2 (Byte 〈xD,x8〉) 〈x0,x4〉 -; quadruple … EOR MODE_IX1 (Byte 〈xE,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_IX0 (Byte 〈xF,x8〉) 〈x0,x3〉 -; quadruple … EOR MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x8〉〉) 〈x0,x5〉 -; quadruple … EOR MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x8〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_20 ≝ -[ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_INHX (Byte 〈x5,xC〉) 〈x0,x1〉 -; quadruple … INC MODE_IX1 (Byte 〈x6,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_IX0 (Byte 〈x7,xC〉) 〈x0,x4〉 -; quadruple … INC MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xC〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_21 ≝ -[ - quadruple … JMP MODE_IMM1EXT (Byte 〈xB,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_IMM2 (Byte 〈xC,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX2ADD (Byte 〈xD,xC〉) 〈x0,x4〉 -; quadruple … JMP MODE_INHX1ADD (Byte 〈xE,xC〉) 〈x0,x3〉 -; quadruple … JMP MODE_INHX0ADD (Byte 〈xF,xC〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_HCS08_22 ≝ -[ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM1EXT (Byte 〈xB,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xC,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX2ADD (Byte 〈xD,xD〉) 〈x0,x6〉 -; quadruple … JSR MODE_INHX1ADD (Byte 〈xE,xD〉) 〈x0,x5〉 -; quadruple … JSR MODE_INHX0ADD (Byte 〈xF,xD〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08_23 ≝ -[ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_DIR2 (Byte 〈xC,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX2 (Byte 〈xD,x6〉) 〈x0,x4〉 -; quadruple … LDA MODE_IX1 (Byte 〈xE,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_IX0 (Byte 〈xF,x6〉) 〈x0,x3〉 -; quadruple … LDA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x6〉〉) 〈x0,x5〉 -; quadruple … LDA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x6〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_24 ≝ -[ - quadruple … LDX MODE_IMM1 (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … LDX MODE_DIR1 (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_DIR2 (Byte 〈xC,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX2 (Byte 〈xD,xE〉) 〈x0,x4〉 -; quadruple … LDX MODE_IX1 (Byte 〈xE,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_IX0 (Byte 〈xF,xE〉) 〈x0,x3〉 -; quadruple … LDX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xE〉〉) 〈x0,x5〉 -; quadruple … LDX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xE〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_25 ≝ -[ - quadruple … LSR MODE_DIR1 (Byte 〈x3,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_INHX (Byte 〈x5,x4〉) 〈x0,x1〉 -; quadruple … LSR MODE_IX1 (Byte 〈x6,x4〉) 〈x0,x5〉 -; quadruple … LSR MODE_IX0 (Byte 〈x7,x4〉) 〈x0,x4〉 -; quadruple … LSR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x4〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_26 ≝ -[ - quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_DIR1_to_IX0p (Byte 〈x5,xE〉) 〈x0,x5〉 -; quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x6,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_IX0p_to_DIR1 (Byte 〈x7,xE〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08_27 ≝ -[ - quadruple … NEG MODE_DIR1 (Byte 〈x3,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_INHA (Byte 〈x4,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_INHX (Byte 〈x5,x0〉) 〈x0,x1〉 -; quadruple … NEG MODE_IX1 (Byte 〈x6,x0〉) 〈x0,x5〉 -; quadruple … NEG MODE_IX0 (Byte 〈x7,x0〉) 〈x0,x4〉 -; quadruple … NEG MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x0〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_28 ≝ -[ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_DIR2 (Byte 〈xC,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX2 (Byte 〈xD,xA〉) 〈x0,x4〉 -; quadruple … ORA MODE_IX1 (Byte 〈xE,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_IX0 (Byte 〈xF,xA〉) 〈x0,x3〉 -; quadruple … ORA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xA〉〉) 〈x0,x5〉 -; quadruple … ORA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xA〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_29 ≝ -[ - quadruple … ROL MODE_DIR1 (Byte 〈x3,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_INHX (Byte 〈x5,x9〉) 〈x0,x1〉 -; quadruple … ROL MODE_IX1 (Byte 〈x6,x9〉) 〈x0,x5〉 -; quadruple … ROL MODE_IX0 (Byte 〈x7,x9〉) 〈x0,x4〉 -; quadruple … ROL MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x9〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_30 ≝ -[ - quadruple … ROR MODE_DIR1 (Byte 〈x3,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_INHX (Byte 〈x5,x6〉) 〈x0,x1〉 -; quadruple … ROR MODE_IX1 (Byte 〈x6,x6〉) 〈x0,x5〉 -; quadruple … ROR MODE_IX0 (Byte 〈x7,x6〉) 〈x0,x4〉 -; quadruple … ROR MODE_SP1 (Word 〈〈x9,xE〉:〈x6,x6〉〉) 〈x0,x6〉 -]. - -ndefinition opcode_table_HCS08_31 ≝ -[ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_DIR2 (Byte 〈xC,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX2 (Byte 〈xD,x2〉) 〈x0,x4〉 -; quadruple … SBC MODE_IX1 (Byte 〈xE,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_IX0 (Byte 〈xF,x2〉) 〈x0,x3〉 -; quadruple … SBC MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x2〉〉) 〈x0,x5〉 -; quadruple … SBC MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x2〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_32 ≝ -[ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_DIR2 (Byte 〈xC,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX2 (Byte 〈xD,x7〉) 〈x0,x4〉 -; quadruple … STA MODE_IX1 (Byte 〈xE,x7〉) 〈x0,x3〉 -; quadruple … STA MODE_IX0 (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x7〉〉) 〈x0,x5〉 -; quadruple … STA MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x7〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_33 ≝ -[ - quadruple … STX MODE_DIR1 (Byte 〈xB,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_DIR2 (Byte 〈xC,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX2 (Byte 〈xD,xF〉) 〈x0,x4〉 -; quadruple … STX MODE_IX1 (Byte 〈xE,xF〉) 〈x0,x3〉 -; quadruple … STX MODE_IX0 (Byte 〈xF,xF〉) 〈x0,x2〉 -; quadruple … STX MODE_SP2 (Word 〈〈x9,xE〉:〈xD,xF〉〉) 〈x0,x5〉 -; quadruple … STX MODE_SP1 (Word 〈〈x9,xE〉:〈xE,xF〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_34 ≝ -[ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_DIR2 (Byte 〈xC,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX2 (Byte 〈xD,x0〉) 〈x0,x4〉 -; quadruple … SUB MODE_IX1 (Byte 〈xE,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_IX0 (Byte 〈xF,x0〉) 〈x0,x3〉 -; quadruple … SUB MODE_SP2 (Word 〈〈x9,xE〉:〈xD,x0〉〉) 〈x0,x5〉 -; quadruple … SUB MODE_SP1 (Word 〈〈x9,xE〉:〈xE,x0〉〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_HCS08_35 ≝ -[ - quadruple … TST MODE_DIR1 (Byte 〈x3,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_INHA (Byte 〈x4,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_INHX (Byte 〈x5,xD〉) 〈x0,x1〉 -; quadruple … TST MODE_IX1 (Byte 〈x6,xD〉) 〈x0,x4〉 -; quadruple … TST MODE_IX0 (Byte 〈x7,xD〉) 〈x0,x3〉 -; quadruple … TST MODE_SP1 (Word 〈〈x9,xE〉:〈x6,xD〉〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_HCS08 ≝ -opcode_table_HCS08_1 @ opcode_table_HCS08_2 @ opcode_table_HCS08_3 @ opcode_table_HCS08_4 @ -opcode_table_HCS08_5 @ opcode_table_HCS08_6 @ opcode_table_HCS08_7 @ opcode_table_HCS08_8 @ -opcode_table_HCS08_9 @ opcode_table_HCS08_10 @ opcode_table_HCS08_11 @ opcode_table_HCS08_12 @ -opcode_table_HCS08_13 @ opcode_table_HCS08_14 @ opcode_table_HCS08_15 @ opcode_table_HCS08_16 @ -opcode_table_HCS08_17 @ opcode_table_HCS08_18 @ opcode_table_HCS08_19 @ opcode_table_HCS08_20 @ -opcode_table_HCS08_21 @ opcode_table_HCS08_22 @ opcode_table_HCS08_23 @ opcode_table_HCS08_24 @ -opcode_table_HCS08_25 @ opcode_table_HCS08_26 @ opcode_table_HCS08_27 @ opcode_table_HCS08_28 @ -opcode_table_HCS08_29 @ opcode_table_HCS08_30 @ opcode_table_HCS08_31 @ opcode_table_HCS08_32 @ -opcode_table_HCS08_33 @ opcode_table_HCS08_34 @ opcode_table_HCS08_35. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table_tests.ma b/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table_tests.ma deleted file mode 100755 index 862c9c534..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/HCS08_table_tests.ma +++ /dev/null @@ -1,101 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "freescale/opcode.ma". - -(* ****************** *) -(* TABELLA DELL'HCS08 *) -(* ****************** *) - -(* HCS08: opcode non implementati come da manuale (byte) *) -ndefinition HCS08_not_impl_byte ≝ - [〈x8,xD〉 - ;〈x9,xE〉 - ;〈xA,xC〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_byte_table_HCS08 : forall_b8 (λb. - (test_not_impl_byte b HCS08_not_impl_byte ⊙ eq_w16 (get_byte_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b HCS08_not_impl_byte) ⊙ eq_w16 (get_byte_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* HCS08: opcode non implementati come da manuale (0x9E+byte) *) -ndefinition HCS08_not_impl_word ≝ - [〈x0,x0〉;〈x0,x1〉;〈x0,x2〉;〈x0,x3〉;〈x0,x4〉;〈x0,x5〉;〈x0,x6〉;〈x0,x7〉 - ;〈x0,x8〉;〈x0,x9〉;〈x0,xA〉;〈x0,xB〉;〈x0,xC〉;〈x0,xD〉;〈x0,xE〉;〈x0,xF〉 - ;〈x1,x0〉;〈x1,x1〉;〈x1,x2〉;〈x1,x3〉;〈x1,x4〉;〈x1,x5〉;〈x1,x6〉;〈x1,x7〉 - ;〈x1,x8〉;〈x1,x9〉;〈x1,xA〉;〈x1,xB〉;〈x1,xC〉;〈x1,xD〉;〈x1,xE〉;〈x1,xF〉 - ;〈x2,x0〉;〈x2,x1〉;〈x2,x2〉;〈x2,x3〉;〈x2,x4〉;〈x2,x5〉;〈x2,x6〉;〈x2,x7〉 - ;〈x2,x8〉;〈x2,x9〉;〈x2,xA〉;〈x2,xB〉;〈x2,xC〉;〈x2,xD〉;〈x2,xE〉;〈x2,xF〉 - ;〈x3,x0〉;〈x3,x1〉;〈x3,x2〉;〈x3,x3〉;〈x3,x4〉;〈x3,x5〉;〈x3,x6〉;〈x3,x7〉 - ;〈x3,x8〉;〈x3,x9〉;〈x3,xA〉;〈x3,xB〉;〈x3,xC〉;〈x3,xD〉;〈x3,xE〉;〈x3,xF〉 - ;〈x4,x0〉;〈x4,x1〉;〈x4,x2〉;〈x4,x3〉;〈x4,x4〉;〈x4,x5〉;〈x4,x6〉;〈x4,x7〉 - ;〈x4,x8〉;〈x4,x9〉;〈x4,xA〉;〈x4,xB〉;〈x4,xC〉;〈x4,xD〉;〈x4,xE〉;〈x4,xF〉 - ;〈x5,x0〉;〈x5,x1〉;〈x5,x2〉;〈x5,x3〉;〈x5,x4〉;〈x5,x5〉;〈x5,x6〉;〈x5,x7〉 - ;〈x5,x8〉;〈x5,x9〉;〈x5,xA〉;〈x5,xB〉;〈x5,xC〉;〈x5,xD〉;〈x5,xE〉;〈x5,xF〉 - ;〈x6,x2〉;〈x6,x5〉;〈x6,xE〉 - ;〈x7,x0〉;〈x7,x1〉;〈x7,x2〉;〈x7,x3〉;〈x7,x4〉;〈x7,x5〉;〈x7,x6〉;〈x7,x7〉 - ;〈x7,x8〉;〈x7,x9〉;〈x7,xA〉;〈x7,xB〉;〈x7,xC〉;〈x7,xD〉;〈x7,xE〉;〈x7,xF〉 - ;〈x8,x0〉;〈x8,x1〉;〈x8,x2〉;〈x8,x3〉;〈x8,x4〉;〈x8,x5〉;〈x8,x6〉;〈x8,x7〉 - ;〈x8,x8〉;〈x8,x9〉;〈x8,xA〉;〈x8,xB〉;〈x8,xC〉;〈x8,xD〉;〈x8,xE〉;〈x8,xF〉 - ;〈x9,x0〉;〈x9,x1〉;〈x9,x2〉;〈x9,x3〉;〈x9,x4〉;〈x9,x5〉;〈x9,x6〉;〈x9,x7〉 - ;〈x9,x8〉;〈x9,x9〉;〈x9,xA〉;〈x9,xB〉;〈x9,xC〉;〈x9,xD〉;〈x9,xE〉;〈x9,xF〉 - ;〈xA,x0〉;〈xA,x1〉;〈xA,x2〉;〈xA,x3〉;〈xA,x4〉;〈xA,x5〉;〈xA,x6〉;〈xA,x7〉;〈xA,x8〉;〈xA,x9〉;〈xA,xA〉;〈xA,xB〉;〈xA,xC〉;〈xA,xD〉;〈xA,xF〉 - ;〈xB,x0〉;〈xB,x1〉;〈xB,x2〉;〈xB,x3〉;〈xB,x4〉;〈xB,x5〉;〈xB,x6〉;〈xB,x7〉;〈xB,x8〉;〈xB,x9〉;〈xB,xA〉;〈xB,xB〉;〈xB,xC〉;〈xB,xD〉;〈xB,xF〉 - ;〈xC,x0〉;〈xC,x1〉;〈xC,x2〉;〈xC,x3〉;〈xC,x4〉;〈xC,x5〉;〈xC,x6〉;〈xC,x7〉;〈xC,x8〉;〈xC,x9〉;〈xC,xA〉;〈xC,xB〉;〈xC,xC〉;〈xC,xD〉;〈xC,xF〉 - ;〈xD,xC〉;〈xD,xD〉 - ;〈xE,xC〉;〈xE,xD〉 - ;〈xF,x0〉;〈xF,x1〉;〈xF,x2〉;〈xF,x4〉;〈xF,x5〉;〈xF,x6〉;〈xF,x7〉;〈xF,x8〉;〈xF,x9〉;〈xF,xA〉;〈xF,xB〉;〈xF,xC〉;〈xF,xD〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_word_table_HCS08 : forall_b8 (λb. - (test_not_impl_byte b HCS08_not_impl_word ⊙ eq_w16 (get_word_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b HCS08_not_impl_word) ⊙ eq_w16 (get_word_count HCS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* tutti op implementati *) -nlemma ok_pseudo_table_HCS08 : - forall_op HCS08 (λo. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HCS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) = true. - napply refl_eq. -nqed. - -(* tutte im implementate *) -nlemma ok_mode_table_HCS08 : - forall_im HCS08 (λi. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HCS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) = true. - napply refl_eq. -nqed. - -(* nessuna ripetizione di combinazione op + imm *) -nlemma ok_OpIm_table_HCS08 : - forall_im HCS08 (λi. - forall_op HCS08 (λo. - le_w16 (get_OpIm_count HCS08 o i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_opcode_base.ma b/helm/software/matita/contribs/ng_assembly/opcodes/RS08_opcode_base.ma deleted file mode 100755 index 1c9861922..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_opcode_base.ma +++ /dev/null @@ -1,183 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* ********************************************** *) -(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) -(* ********************************************** *) - -(* enumerazione delle modalita' di indirizzamento = caricamento degli operandi *) -ninductive RS08_instr_mode: Type ≝ - (* INHERENT = nessun operando *) - MODE_INH : RS08_instr_mode - (* INHERENT = nessun operando (A implicito) *) -| MODE_INHA : RS08_instr_mode - - (* IMMEDIATE = operando valore immediato byte = 0xbb *) -| MODE_IMM1 : RS08_instr_mode - (* IMMEDIATE = operando valore immediato word = 0xwwww *) -| MODE_IMM2 : RS08_instr_mode - (* DIRECT = operando offset byte = [0x00bb] *) -| MODE_DIR1 : RS08_instr_mode - - (* DIRECT → DIRECT = carica da diretto/scrive su diretto *) -| MODE_DIR1_to_DIR1 : RS08_instr_mode - (* IMMEDIATE → DIRECT = carica da immediato/scrive su diretto *) -| MODE_IMM1_to_DIR1 : RS08_instr_mode - - (* INHERENT(A) + IMMEDIATE *) -| MODE_INHA_and_IMM1 : RS08_instr_mode - (* IMMEDIATE + IMMEDIATE *) -| MODE_IMM1_and_IMM1 : RS08_instr_mode - (* DIRECT + IMMEDIATE *) -| MODE_DIR1_and_IMM1 : RS08_instr_mode - - (* DIRECT(mTNY) = operando offset byte(maschera scrittura implicita 3 bit) *) - (* ex: DIR3 e' carica b, scrivi b con n-simo bit modificato *) -| MODE_DIRn : oct → RS08_instr_mode - (* DIRECT(mTNY) + IMMEDIATE = operando offset byte(maschera lettura implicita 3 bit) *) - (* + operando valore immediato byte *) - (* ex: DIR2_and_IMM1 e' carica b, carica imm, restituisci n-simo bit di b + imm *) -| MODE_DIRn_and_IMM1 : oct → RS08_instr_mode - (* TINY = nessun operando (diretto implicito 4bit = [0x00000000:0000iiii]) *) -| MODE_TNY : exadecim → RS08_instr_mode - (* SHORT = nessun operando (diretto implicito 5bit = [0x00000000:000iiiii]) *) -| MODE_SRT : bitrigesim → RS08_instr_mode -. - -ndefinition eq_RS08_im ≝ -λi1,i2:RS08_instr_mode. - match i1 with - [ MODE_INH ⇒ match i2 with [ MODE_INH ⇒ true | _ ⇒ false ] - | MODE_INHA ⇒ match i2 with [ MODE_INHA ⇒ true | _ ⇒ false ] - | MODE_IMM1 ⇒ match i2 with [ MODE_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM2 ⇒ match i2 with [ MODE_IMM2 ⇒ true | _ ⇒ false ] - | MODE_DIR1 ⇒ match i2 with [ MODE_DIR1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_to_DIR1 ⇒ match i2 with [ MODE_DIR1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_to_DIR1 ⇒ match i2 with [ MODE_IMM1_to_DIR1 ⇒ true | _ ⇒ false ] - | MODE_INHA_and_IMM1 ⇒ match i2 with [ MODE_INHA_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_IMM1_and_IMM1 ⇒ match i2 with [ MODE_IMM1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIR1_and_IMM1 ⇒ match i2 with [ MODE_DIR1_and_IMM1 ⇒ true | _ ⇒ false ] - | MODE_DIRn n1 ⇒ match i2 with [ MODE_DIRn n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - | MODE_DIRn_and_IMM1 n1 ⇒ match i2 with [ MODE_DIRn_and_IMM1 n2 ⇒ eq_oct n1 n2 | _ ⇒ false ] - | MODE_TNY e1 ⇒ match i2 with [ MODE_TNY e2 ⇒ eq_ex e1 e2 | _ ⇒ false ] - | MODE_SRT t1 ⇒ match i2 with [ MODE_SRT t2 ⇒ eq_bit t1 t2 | _ ⇒ false ] - ]. - -(* iteratore sulle modalita' *) -ndefinition forall_RS08_im ≝ λP:RS08_instr_mode → bool. - P MODE_INH -⊗ P MODE_INHA -⊗ P MODE_IMM1 -⊗ P MODE_IMM2 -⊗ P MODE_DIR1 -⊗ P MODE_DIR1_to_DIR1 -⊗ P MODE_IMM1_to_DIR1 -⊗ P MODE_INHA_and_IMM1 -⊗ P MODE_IMM1_and_IMM1 -⊗ P MODE_DIR1_and_IMM1 -⊗ forall_oct (λo. P (MODE_DIRn o)) -⊗ forall_oct (λo. P (MODE_DIRn_and_IMM1 o)) -⊗ forall_ex (λe. P (MODE_TNY e)) -⊗ forall_bit (λt. P (MODE_SRT t)). - -(* enumerazione delle istruzioni *) -ninductive RS08_opcode: Type ≝ - ADC : RS08_opcode (* add with carry *) -| ADD : RS08_opcode (* add *) -| AND : RS08_opcode (* and *) -| ASL : RS08_opcode (* aritmetic shift left *) -| BCC : RS08_opcode (* branch if C=0 *) -| BCLRn : RS08_opcode (* clear bit n *) -| BCS : RS08_opcode (* branch if C=1 *) -| BEQ : RS08_opcode (* branch if Z=1 *) -| BGND : RS08_opcode (* !!background mode!! *) -| BNE : RS08_opcode (* branch if Z=0 *) -| BRA : RS08_opcode (* branch always *) -| BRCLRn : RS08_opcode (* branch if bit n clear *) -| BRSETn : RS08_opcode (* branch if bit n set *) -| BSETn : RS08_opcode (* set bit n *) -| BSR : RS08_opcode (* branch to subroutine *) -| CBEQA : RS08_opcode (* compare (A) and BEQ *) -| CLC : RS08_opcode (* C=0 *) -| CLR : RS08_opcode (* operand=0 *) -| CMP : RS08_opcode (* flag = sub (compare A) *) -| COM : RS08_opcode (* not (1 complement) *) -| DBNZ : RS08_opcode (* dec and BNE *) -| DEC : RS08_opcode (* operand=operand-1 (decrement) *) -| EOR : RS08_opcode (* xor *) -| INC : RS08_opcode (* operand=operand+1 (increment) *) -| JMP : RS08_opcode (* jmp word [operand] *) -| JSR : RS08_opcode (* jmp to subroutine *) -| LDA : RS08_opcode (* load in A *) -| LSR : RS08_opcode (* logical shift right *) -| MOV : RS08_opcode (* move *) -| NOP : RS08_opcode (* nop *) -| ORA : RS08_opcode (* or *) -| ROL : RS08_opcode (* rotate left *) -| ROR : RS08_opcode (* rotate right *) -| RTS : RS08_opcode (* return from subroutine *) -| SBC : RS08_opcode (* sub with carry*) -| SEC : RS08_opcode (* C=1 *) -| SHA : RS08_opcode (* swap spc_high,A *) -| SLA : RS08_opcode (* swap spc_low,A *) -| STA : RS08_opcode (* store from A *) -| STOP : RS08_opcode (* !!stop mode!! *) -| SUB : RS08_opcode (* sub *) -| WAIT : RS08_opcode (* !!wait mode!! *) -. - -ndefinition eq_RS08_op ≝ -λop1,op2:RS08_opcode. - match op1 with - [ ADC ⇒ match op2 with [ ADC ⇒ true | _ ⇒ false ] | ADD ⇒ match op2 with [ ADD ⇒ true | _ ⇒ false ] - | AND ⇒ match op2 with [ AND ⇒ true | _ ⇒ false ] | ASL ⇒ match op2 with [ ASL ⇒ true | _ ⇒ false ] - | BCC ⇒ match op2 with [ BCC ⇒ true | _ ⇒ false ] | BCLRn ⇒ match op2 with [ BCLRn ⇒ true | _ ⇒ false ] - | BCS ⇒ match op2 with [ BCS ⇒ true | _ ⇒ false ] | BEQ ⇒ match op2 with [ BEQ ⇒ true | _ ⇒ false ] - | BGND ⇒ match op2 with [ BGND ⇒ true | _ ⇒ false ] | BNE ⇒ match op2 with [ BNE ⇒ true | _ ⇒ false ] - | BRA ⇒ match op2 with [ BRA ⇒ true | _ ⇒ false ] | BRCLRn ⇒ match op2 with [ BRCLRn ⇒ true | _ ⇒ false ] - | BRSETn ⇒ match op2 with [ BRSETn ⇒ true | _ ⇒ false ] | BSETn ⇒ match op2 with [ BSETn ⇒ true | _ ⇒ false ] - | BSR ⇒ match op2 with [ BSR ⇒ true | _ ⇒ false ] | CBEQA ⇒ match op2 with [ CBEQA ⇒ true | _ ⇒ false ] - | CLC ⇒ match op2 with [ CLC ⇒ true | _ ⇒ false ] | CLR ⇒ match op2 with [ CLR ⇒ true | _ ⇒ false ] - | CMP ⇒ match op2 with [ CMP ⇒ true | _ ⇒ false ] | COM ⇒ match op2 with [ COM ⇒ true | _ ⇒ false ] - | DBNZ ⇒ match op2 with [ DBNZ ⇒ true | _ ⇒ false ] | DEC ⇒ match op2 with [ DEC ⇒ true | _ ⇒ false ] - | EOR ⇒ match op2 with [ EOR ⇒ true | _ ⇒ false ] | INC ⇒ match op2 with [ INC ⇒ true | _ ⇒ false ] - | JMP ⇒ match op2 with [ JMP ⇒ true | _ ⇒ false ] | JSR ⇒ match op2 with [ JSR ⇒ true | _ ⇒ false ] - | LDA ⇒ match op2 with [ LDA ⇒ true | _ ⇒ false ] | LSR ⇒ match op2 with [ LSR ⇒ true | _ ⇒ false ] - | MOV ⇒ match op2 with [ MOV ⇒ true | _ ⇒ false ] | NOP ⇒ match op2 with [ NOP ⇒ true | _ ⇒ false ] - | ORA ⇒ match op2 with [ ORA ⇒ true | _ ⇒ false ] | ROL ⇒ match op2 with [ ROL ⇒ true | _ ⇒ false ] - | ROR ⇒ match op2 with [ ROR ⇒ true | _ ⇒ false ] | RTS ⇒ match op2 with [ RTS ⇒ true | _ ⇒ false ] - | SBC ⇒ match op2 with [ SBC ⇒ true | _ ⇒ false ] | SEC ⇒ match op2 with [ SEC ⇒ true | _ ⇒ false ] - | SHA ⇒ match op2 with [ SHA ⇒ true | _ ⇒ false ] | SLA ⇒ match op2 with [ SLA ⇒ true | _ ⇒ false ] - | STA ⇒ match op2 with [ STA ⇒ true | _ ⇒ false ] | STOP ⇒ match op2 with [ STOP ⇒ true | _ ⇒ false ] - | SUB ⇒ match op2 with [ SUB ⇒ true | _ ⇒ false ] | WAIT ⇒ match op2 with [ WAIT ⇒ true | _ ⇒ false ] - ]. - -(* iteratore sugli opcode *) -ndefinition forall_RS08_op ≝ λP:RS08_opcode → bool. - P ADC ⊗ P ADD ⊗ P AND ⊗ P ASL ⊗ P BCC ⊗ P BCLRn ⊗ P BCS ⊗ P BEQ ⊗ - P BGND ⊗ P BNE ⊗ P BRA ⊗ P BRCLRn ⊗ P BRSETn ⊗ P BSETn ⊗ P BSR ⊗ P CBEQA ⊗ - P CLC ⊗ P CLR ⊗ P CMP ⊗ P COM ⊗ P DBNZ ⊗ P DEC ⊗ P EOR ⊗ P INC ⊗ - P JMP ⊗ P JSR ⊗ P LDA ⊗ P LSR ⊗ P MOV ⊗ P NOP ⊗ P ORA ⊗ P ROL ⊗ - P ROR ⊗ P RTS ⊗ P SBC ⊗ P SEC ⊗ P SHA ⊗ P SLA ⊗ P STA ⊗ P STOP ⊗ - P SUB ⊗ P WAIT. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table.ma b/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table.ma deleted file mode 100755 index b24232b87..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table.ma +++ /dev/null @@ -1,396 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/RS08_opcode_base.ma". -include "opcodes/byte_or_word.ma". -include "common/list.ma". - -(* ***************** *) -(* TABELLA DELL'RS08 *) -(* ***************** *) - -(* definizione come concatenazione finale di liste per velocizzare il parsing *) -(* ogni riga e' (any_opcode m) (instr_mode) (opcode esadecimale) (#cicli esecuzione) *) -(* NB: l'uso di any_opcode m + concatenazione finale tutte liste - impedisce di introdurre opcode disomogenei (per mcu) *) - -ndefinition opcode_table_RS08_1 ≝ -[ - quadruple … ADC MODE_IMM1 (Byte 〈xA,x9〉) 〈x0,x2〉 -; quadruple … ADC MODE_DIR1 (Byte 〈xB,x9〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_2 ≝ -[ - quadruple … ADD MODE_IMM1 (Byte 〈xA,xB〉) 〈x0,x2〉 -; quadruple … ADD MODE_DIR1 (Byte 〈xB,xB〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x0) (Byte 〈x6,x0〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x1) (Byte 〈x6,x1〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x2) (Byte 〈x6,x2〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x3) (Byte 〈x6,x3〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x4) (Byte 〈x6,x4〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x5) (Byte 〈x6,x5〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x6) (Byte 〈x6,x6〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x7) (Byte 〈x6,x7〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x8) (Byte 〈x6,x8〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY x9) (Byte 〈x6,x9〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xA) (Byte 〈x6,xA〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xB) (Byte 〈x6,xB〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xC) (Byte 〈x6,xC〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xD) (Byte 〈x6,xD〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xE) (Byte 〈x6,xE〉) 〈x0,x3〉 -; quadruple … ADD (MODE_TNY xF) (Byte 〈x6,xF〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_3 ≝ -[ - quadruple … AND MODE_IMM1 (Byte 〈xA,x4〉) 〈x0,x2〉 -; quadruple … AND MODE_DIR1 (Byte 〈xB,x4〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_4 ≝ -[ - quadruple … ASL MODE_INHA (Byte 〈x4,x8〉) 〈x0,x1〉 -]. - -ndefinition opcode_table_RS08_5 ≝ -[ - quadruple … BRA MODE_IMM1 (Byte 〈x3,x0〉) 〈x0,x3〉 -; quadruple … BCC MODE_IMM1 (Byte 〈x3,x4〉) 〈x0,x3〉 -; quadruple … BCS MODE_IMM1 (Byte 〈x3,x5〉) 〈x0,x3〉 -; quadruple … BNE MODE_IMM1 (Byte 〈x3,x6〉) 〈x0,x3〉 -; quadruple … BEQ MODE_IMM1 (Byte 〈x3,x7〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_6 ≝ -[ - quadruple … BSETn (MODE_DIRn o0) (Byte 〈x1,x0〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o0) (Byte 〈x1,x1〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o1) (Byte 〈x1,x2〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o1) (Byte 〈x1,x3〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o2) (Byte 〈x1,x4〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o2) (Byte 〈x1,x5〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o3) (Byte 〈x1,x6〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o3) (Byte 〈x1,x7〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o4) (Byte 〈x1,x8〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o4) (Byte 〈x1,x9〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o5) (Byte 〈x1,xA〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o5) (Byte 〈x1,xB〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o6) (Byte 〈x1,xC〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o6) (Byte 〈x1,xD〉) 〈x0,x5〉 -; quadruple … BSETn (MODE_DIRn o7) (Byte 〈x1,xE〉) 〈x0,x5〉 -; quadruple … BCLRn (MODE_DIRn o7) (Byte 〈x1,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_RS08_7 ≝ -[ - quadruple … BRSETn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x0〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o0) (Byte 〈x0,x1〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x2〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o1) (Byte 〈x0,x3〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x4〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o2) (Byte 〈x0,x5〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x6〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o3) (Byte 〈x0,x7〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x8〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o4) (Byte 〈x0,x9〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xA〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o5) (Byte 〈x0,xB〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xC〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o6) (Byte 〈x0,xD〉) 〈x0,x5〉 -; quadruple … BRSETn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xE〉) 〈x0,x5〉 -; quadruple … BRCLRn (MODE_DIRn_and_IMM1 o7) (Byte 〈x0,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_RS08_8 ≝ -[ - quadruple … CLC MODE_INH (Byte 〈x3,x8〉) 〈x0,x1〉 -; quadruple … SEC MODE_INH (Byte 〈x3,x9〉) 〈x0,x1〉 -; quadruple … SLA MODE_INH (Byte 〈x4,x2〉) 〈x0,x1〉 -; quadruple … SHA MODE_INH (Byte 〈x4,x5〉) 〈x0,x1〉 -; quadruple … NOP MODE_INH (Byte 〈xA,xC〉) 〈x0,x1〉 -; quadruple … STOP MODE_INH (Byte 〈xA,xE〉) 〈x0,x2〉 -; quadruple … WAIT MODE_INH (Byte 〈xA,xF〉) 〈x0,x2〉 -; quadruple … RTS MODE_INH (Byte 〈xB,xE〉) 〈x0,x3〉 -; quadruple … BGND MODE_INH (Byte 〈xB,xF〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_RS08_9 ≝ -[ - quadruple … CBEQA MODE_DIR1_and_IMM1 (Byte 〈x3,x1〉) 〈x0,x5〉 -; quadruple … CBEQA MODE_IMM1_and_IMM1 (Byte 〈x4,x1〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_10 ≝ -[ - quadruple … CLR MODE_DIR1 (Byte 〈x3,xF〉) 〈x0,x3〉 -; quadruple … CLR MODE_INHA (Byte 〈x4,xF〉) 〈x0,x1〉 -; quadruple … CLR (MODE_SRT t00) (Byte 〈x8,x0〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t01) (Byte 〈x8,x1〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t02) (Byte 〈x8,x2〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t03) (Byte 〈x8,x3〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t04) (Byte 〈x8,x4〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t05) (Byte 〈x8,x5〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t06) (Byte 〈x8,x6〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t07) (Byte 〈x8,x7〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t08) (Byte 〈x8,x8〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t09) (Byte 〈x8,x9〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0A) (Byte 〈x8,xA〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0B) (Byte 〈x8,xB〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0C) (Byte 〈x8,xC〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0D) (Byte 〈x8,xD〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0E) (Byte 〈x8,xE〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t0F) (Byte 〈x8,xF〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t10) (Byte 〈x9,x0〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t11) (Byte 〈x9,x1〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t12) (Byte 〈x9,x2〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t13) (Byte 〈x9,x3〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t14) (Byte 〈x9,x4〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t15) (Byte 〈x9,x5〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t16) (Byte 〈x9,x6〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t17) (Byte 〈x9,x7〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t18) (Byte 〈x9,x8〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t19) (Byte 〈x9,x9〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1A) (Byte 〈x9,xA〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1B) (Byte 〈x9,xB〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1C) (Byte 〈x9,xC〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1D) (Byte 〈x9,xD〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1E) (Byte 〈x9,xE〉) 〈x0,x2〉 -; quadruple … CLR (MODE_SRT t1F) (Byte 〈x9,xF〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_RS08_11 ≝ -[ - quadruple … CMP MODE_IMM1 (Byte 〈xA,x1〉) 〈x0,x2〉 -; quadruple … CMP MODE_DIR1 (Byte 〈xB,x1〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_12 ≝ -[ - quadruple … COM MODE_INHA (Byte 〈x4,x3〉) 〈x0,x1〉 -]. - -ndefinition opcode_table_RS08_13 ≝ -[ - quadruple … DBNZ MODE_DIR1_and_IMM1 (Byte 〈x3,xB〉) 〈x0,x7〉 -; quadruple … DBNZ MODE_INHA_and_IMM1 (Byte 〈x4,xB〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_14 ≝ -[ - quadruple … DEC MODE_DIR1 (Byte 〈x3,xA〉) 〈x0,x5〉 -; quadruple … DEC MODE_INHA (Byte 〈x4,xA〉) 〈x0,x1〉 -; quadruple … DEC (MODE_TNY x0) (Byte 〈x5,x0〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x1) (Byte 〈x5,x1〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x2) (Byte 〈x5,x2〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x3) (Byte 〈x5,x3〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x4) (Byte 〈x5,x4〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x5) (Byte 〈x5,x5〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x6) (Byte 〈x5,x6〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x7) (Byte 〈x5,x7〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x8) (Byte 〈x5,x8〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY x9) (Byte 〈x5,x9〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xA) (Byte 〈x5,xA〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xB) (Byte 〈x5,xB〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xC) (Byte 〈x5,xC〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xD) (Byte 〈x5,xD〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xE) (Byte 〈x5,xE〉) 〈x0,x4〉 -; quadruple … DEC (MODE_TNY xF) (Byte 〈x5,xF〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_15 ≝ -[ - quadruple … EOR MODE_IMM1 (Byte 〈xA,x8〉) 〈x0,x2〉 -; quadruple … EOR MODE_DIR1 (Byte 〈xB,x8〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_16 ≝ -[ - quadruple … INC MODE_DIR1 (Byte 〈x3,xC〉) 〈x0,x5〉 -; quadruple … INC MODE_INHA (Byte 〈x4,xC〉) 〈x0,x1〉 -; quadruple … INC (MODE_TNY x0) (Byte 〈x2,x0〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x1) (Byte 〈x2,x1〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x2) (Byte 〈x2,x2〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x3) (Byte 〈x2,x3〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x4) (Byte 〈x2,x4〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x5) (Byte 〈x2,x5〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x6) (Byte 〈x2,x6〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x7) (Byte 〈x2,x7〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x8) (Byte 〈x2,x8〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY x9) (Byte 〈x2,x9〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xA) (Byte 〈x2,xA〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xB) (Byte 〈x2,xB〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xC) (Byte 〈x2,xC〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xD) (Byte 〈x2,xD〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xE) (Byte 〈x2,xE〉) 〈x0,x4〉 -; quadruple … INC (MODE_TNY xF) (Byte 〈x2,xF〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_17 ≝ -[ - quadruple … JMP MODE_IMM2 (Byte 〈xB,xC〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_18 ≝ -[ - quadruple … BSR MODE_IMM1 (Byte 〈xA,xD〉) 〈x0,x3〉 -; quadruple … JSR MODE_IMM2 (Byte 〈xB,xD〉) 〈x0,x4〉 -]. - -ndefinition opcode_table_RS08_19 ≝ -[ - quadruple … LDA MODE_IMM1 (Byte 〈xA,x6〉) 〈x0,x2〉 -; quadruple … LDA MODE_DIR1 (Byte 〈xB,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t00) (Byte 〈xC,x0〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t01) (Byte 〈xC,x1〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t02) (Byte 〈xC,x2〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t03) (Byte 〈xC,x3〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t04) (Byte 〈xC,x4〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t05) (Byte 〈xC,x5〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t06) (Byte 〈xC,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t07) (Byte 〈xC,x7〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t08) (Byte 〈xC,x8〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t09) (Byte 〈xC,x9〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0A) (Byte 〈xC,xA〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0B) (Byte 〈xC,xB〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0C) (Byte 〈xC,xC〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0D) (Byte 〈xC,xD〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0E) (Byte 〈xC,xE〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t0F) (Byte 〈xC,xF〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t10) (Byte 〈xD,x0〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t11) (Byte 〈xD,x1〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t12) (Byte 〈xD,x2〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t13) (Byte 〈xD,x3〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t14) (Byte 〈xD,x4〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t15) (Byte 〈xD,x5〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t16) (Byte 〈xD,x6〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t17) (Byte 〈xD,x7〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t18) (Byte 〈xD,x8〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t19) (Byte 〈xD,x9〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1A) (Byte 〈xD,xA〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1B) (Byte 〈xD,xB〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1C) (Byte 〈xD,xC〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1D) (Byte 〈xD,xD〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1E) (Byte 〈xD,xE〉) 〈x0,x3〉 -; quadruple … LDA (MODE_SRT t1F) (Byte 〈xD,xF〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_20 ≝ -[ - quadruple … LSR MODE_INHA (Byte 〈x4,x4〉) 〈x0,x1〉 -]. - -ndefinition opcode_table_RS08_21 ≝ -[ - quadruple … MOV MODE_IMM1_to_DIR1 (Byte 〈x3,xE〉) 〈x0,x4〉 -; quadruple … MOV MODE_DIR1_to_DIR1 (Byte 〈x4,xE〉) 〈x0,x5〉 -]. - -ndefinition opcode_table_RS08_22 ≝ -[ - quadruple … ORA MODE_IMM1 (Byte 〈xA,xA〉) 〈x0,x2〉 -; quadruple … ORA MODE_DIR1 (Byte 〈xB,xA〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_23 ≝ -[ - quadruple … ROL MODE_INHA (Byte 〈x4,x9〉) 〈x0,x1〉 -]. - -ndefinition opcode_table_RS08_24 ≝ -[ - quadruple … ROR MODE_INHA (Byte 〈x4,x6〉) 〈x0,x1〉 -]. - -ndefinition opcode_table_RS08_25 ≝ -[ - quadruple … SBC MODE_IMM1 (Byte 〈xA,x2〉) 〈x0,x2〉 -; quadruple … SBC MODE_DIR1 (Byte 〈xB,x2〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08_26 ≝ -[ - quadruple … STA MODE_DIR1 (Byte 〈xB,x7〉) 〈x0,x3〉 -; quadruple … STA (MODE_SRT t00) (Byte 〈xE,x0〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t01) (Byte 〈xE,x1〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t02) (Byte 〈xE,x2〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t03) (Byte 〈xE,x3〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t04) (Byte 〈xE,x4〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t05) (Byte 〈xE,x5〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t06) (Byte 〈xE,x6〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t07) (Byte 〈xE,x7〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t08) (Byte 〈xE,x8〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t09) (Byte 〈xE,x9〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0A) (Byte 〈xE,xA〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0B) (Byte 〈xE,xB〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0C) (Byte 〈xE,xC〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0D) (Byte 〈xE,xD〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0E) (Byte 〈xE,xE〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t0F) (Byte 〈xE,xF〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t10) (Byte 〈xF,x0〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t11) (Byte 〈xF,x1〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t12) (Byte 〈xF,x2〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t13) (Byte 〈xF,x3〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t14) (Byte 〈xF,x4〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t15) (Byte 〈xF,x5〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t16) (Byte 〈xF,x6〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t17) (Byte 〈xF,x7〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t18) (Byte 〈xF,x8〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t19) (Byte 〈xF,x9〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1A) (Byte 〈xF,xA〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1B) (Byte 〈xF,xB〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1C) (Byte 〈xF,xC〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1D) (Byte 〈xF,xD〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1E) (Byte 〈xF,xE〉) 〈x0,x2〉 -; quadruple … STA (MODE_SRT t1F) (Byte 〈xF,xF〉) 〈x0,x2〉 -]. - -ndefinition opcode_table_RS08_27 ≝ -[ - quadruple … SUB MODE_IMM1 (Byte 〈xA,x0〉) 〈x0,x2〉 -; quadruple … SUB MODE_DIR1 (Byte 〈xB,x0〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x0) (Byte 〈x7,x0〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x1) (Byte 〈x7,x1〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x2) (Byte 〈x7,x2〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x3) (Byte 〈x7,x3〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x4) (Byte 〈x7,x4〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x5) (Byte 〈x7,x5〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x6) (Byte 〈x7,x6〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x7) (Byte 〈x7,x7〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x8) (Byte 〈x7,x8〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY x9) (Byte 〈x7,x9〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xA) (Byte 〈x7,xA〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xB) (Byte 〈x7,xB〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xC) (Byte 〈x7,xC〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xD) (Byte 〈x7,xD〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xE) (Byte 〈x7,xE〉) 〈x0,x3〉 -; quadruple … SUB (MODE_TNY xF) (Byte 〈x7,xF〉) 〈x0,x3〉 -]. - -ndefinition opcode_table_RS08 ≝ -opcode_table_RS08_1 @ opcode_table_RS08_2 @ opcode_table_RS08_3 @ opcode_table_RS08_4 @ -opcode_table_RS08_5 @ opcode_table_RS08_6 @ opcode_table_RS08_7 @ opcode_table_RS08_8 @ -opcode_table_RS08_9 @ opcode_table_RS08_10 @ opcode_table_RS08_11 @ opcode_table_RS08_12 @ -opcode_table_RS08_13 @ opcode_table_RS08_14 @ opcode_table_RS08_15 @ opcode_table_RS08_16 @ -opcode_table_RS08_17 @ opcode_table_RS08_18 @ opcode_table_RS08_19 @ opcode_table_RS08_20 @ -opcode_table_RS08_21 @ opcode_table_RS08_22 @ opcode_table_RS08_23 @ opcode_table_RS08_24 @ -opcode_table_RS08_25 @ opcode_table_RS08_26 @ opcode_table_RS08_27. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table_tests.ma b/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table_tests.ma deleted file mode 100755 index c831f120f..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/RS08_table_tests.ma +++ /dev/null @@ -1,65 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "freescale/opcode.ma". - -(* ***************** *) -(* TABELLA DELL'RS08 *) -(* ***************** *) - -(* RS08: opcode non implementati come da manuale *) -ndefinition RS08_not_impl_byte ≝ - [〈x3,x2〉;〈x3,x3〉;〈x3,xD〉 - ;〈x4,x0〉;〈x4,x7〉;〈x4,xD〉 - ;〈xA,x3〉;〈xA,x5〉;〈xA,x7〉 - ;〈xB,x3〉;〈xB,x5〉 - ]. - -(* test bytecode non implementati *) -nlemma ok_byte_table_RS08 : forall_b8 (λb. - (test_not_impl_byte b RS08_not_impl_byte ⊙ eq_w16 (get_byte_count RS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ - (⊖ (test_not_impl_byte b RS08_not_impl_byte) ⊙ eq_w16 (get_byte_count RS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) - = true. - napply refl_eq. -nqed. - -(* tutti op implementati *) -nlemma ok_pseudo_table_RS08 : - forall_op RS08 (λo. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count RS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) = true. - napply refl_eq. -nqed. - -(* tutte im implementate *) -nlemma ok_mode_table_RS08 : - forall_im RS08 (λi. - le_w16 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count RS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) = true. - napply refl_eq. -nqed. - -(* nessuna ripetizione di combinazione op + imm *) -nlemma ok_OpIm_table_RS08 : - forall_im RS08 (λi. - forall_op RS08 (λo. - le_w16 (get_OpIm_count RS08 o i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. - napply refl_eq. -nqed. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/byte_or_word.ma b/helm/software/matita/contribs/ng_assembly/opcodes/byte_or_word.ma deleted file mode 100755 index 7c20eb141..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/byte_or_word.ma +++ /dev/null @@ -1,35 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "num/word16.ma". - -(* raggruppamento di byte e word in un tipo unico *) -ninductive byte8_or_word16 : Type ≝ - Byte: byte8 → byte8_or_word16 -| Word: word16 → byte8_or_word16. - -ndefinition eq_b8w16 ≝ -λbw1,bw2:byte8_or_word16. - match bw1 with - [ Byte b1 ⇒ match bw2 with [ Byte b2 ⇒ eq_b8 b1 b2 | Word _ ⇒ false ] - | Word w1 ⇒ match bw2 with [ Byte _ ⇒ false | Word w2 ⇒ eq_w16 w1 w2 ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/opcodes/opcode.ma b/helm/software/matita/contribs/ng_assembly/opcodes/opcode.ma deleted file mode 100755 index 3aaed8fab..000000000 --- a/helm/software/matita/contribs/ng_assembly/opcodes/opcode.ma +++ /dev/null @@ -1,202 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "opcodes/HC05_opcode_base.ma". -include "opcodes/HC08_opcode_base.ma". -include "opcodes/HCS08_opcode_base.ma". -include "opcodes/RS08_opcode_base.ma". -include "opcodes/byte_or_word.ma". -include "common/list.ma". - -(* ********************************************** *) -(* MATTONI BASE PER DEFINIRE LE TABELLE DELLE MCU *) -(* ********************************************** *) - -(* enumerazione delle ALU *) -ninductive mcu_type: Type ≝ - HC05 : mcu_type -| HC08 : mcu_type -| HCS08 : mcu_type -| RS08 : mcu_type. - -ndefinition eq_mcutype ≝ -λm1,m2:mcu_type. - match m1 with - [ HC05 ⇒ match m2 with [ HC05 ⇒ true | _ ⇒ false ] - | HC08 ⇒ match m2 with [ HC08 ⇒ true | _ ⇒ false ] - | HCS08 ⇒ match m2 with [ HCS08 ⇒ true | _ ⇒ false ] - | RS08 ⇒ match m2 with [ RS08 ⇒ true | _ ⇒ false ] - ]. - -ndefinition aux_op_type ≝ -λmcu:mcu_type.match mcu with - [ HC05 ⇒ HC05_opcode - | HC08 ⇒ HC08_opcode - | HCS08 ⇒ HCS08_opcode - | RS08 ⇒ RS08_opcode - ]. - -ndefinition aux_im_type ≝ -λmcu:mcu_type.match mcu with - [ HC05 ⇒ HC05_instr_mode - | HC08 ⇒ HC08_instr_mode - | HCS08 ⇒ HCS08_instr_mode - | RS08 ⇒ RS08_instr_mode - ]. - -ndefinition eq_op ≝ -λmcu:mcu_type. - match mcu - return λm.aux_op_type m → aux_op_type m → bool - with - [ HC05 ⇒ eq_HC05_op - | HC08 ⇒ eq_HC08_op - | HCS08 ⇒ eq_HCS08_op - | RS08 ⇒ eq_RS08_op - ]. - -ndefinition eq_im ≝ -λmcu:mcu_type. - match mcu - return λm.aux_im_type m → aux_im_type m → bool - with - [ HC05 ⇒ eq_HC05_im - | HC08 ⇒ eq_HC08_im - | HCS08 ⇒ eq_HCS08_im - | RS08 ⇒ eq_RS08_im - ]. - -ndefinition forall_op ≝ -λmcu:mcu_type. - match mcu - return λm.(aux_op_type m → bool) → bool - with - [ HC05 ⇒ forall_HC05_op - | HC08 ⇒ forall_HC08_op - | HCS08 ⇒ forall_HCS08_op - | RS08 ⇒ forall_RS08_op - ]. - -ndefinition forall_im ≝ -λmcu:mcu_type. - match mcu - return λm.(aux_im_type m → bool) → bool - with - [ HC05 ⇒ forall_HC05_im - | HC08 ⇒ forall_HC08_im - | HCS08 ⇒ forall_HCS08_im - | RS08 ⇒ forall_RS08_im - ]. - -(* ********************************************* *) -(* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *) -(* ********************************************* *) - -ndefinition aux_table_type ≝ λmcu:mcu_type.Prod4T (aux_op_type mcu) (aux_im_type mcu) byte8_or_word16 byte8. - -(* su tutta la lista quante volte compare il byte *) -nlet rec get_byte_count (m:mcu_type) (b:byte8) (c:word16) (l:list (aux_table_type m)) on l ≝ - match l with - [ nil ⇒ c - | cons hd tl ⇒ match thd4T … hd with - [ Byte b' ⇒ match eq_b8 b b' with - [ true ⇒ get_byte_count m b (succ_w16 c) tl - | false ⇒ get_byte_count m b c tl - ] - | Word _ ⇒ get_byte_count m b c tl - ] - ]. - -(* su tutta la lista quante volte compare la word (0x9E+byte) *) -nlet rec get_word_count (m:mcu_type) (b:byte8) (c:word16) (l:list (aux_table_type m)) on l ≝ - match l with - [ nil ⇒ c - | cons hd tl ⇒ match thd4T … hd with - [ Byte _ ⇒ get_word_count m b c tl - | Word w ⇒ match eq_w16 〈〈x9,xE〉:b〉 w with - [ true ⇒ get_word_count m b (succ_w16 c) tl - | false ⇒ get_word_count m b c tl - ] - ] - ]. - -(* su tutta la lista quante volte compare lo pseudocodice *) -nlet rec get_pseudo_count (m:mcu_type) (o:aux_op_type m) (c:word16) (l:list (aux_table_type m)) on l ≝ - match l with - [ nil ⇒ c - | cons hd tl ⇒ match eq_op m o (fst4T … hd) with - [ true ⇒ get_pseudo_count m o (succ_w16 c) tl - | false ⇒ get_pseudo_count m o c tl - ] - ]. - -(* su tutta la lista quante volte compare la modalita' *) -nlet rec get_mode_count (m:mcu_type) (i:aux_im_type m) (c:word16) (l:list (aux_table_type m)) on l ≝ - match l with - [ nil ⇒ c - | cons hd tl ⇒ match eq_im m i (snd4T … hd) with - [ true ⇒ get_mode_count m i (succ_w16 c) tl - | false ⇒ get_mode_count m i c tl - ] - ]. - -(* b e' non implementato? *) -nlet rec test_not_impl_byte (b:byte8) (l:list byte8) on l ≝ - match l with - [ nil ⇒ false - | cons hd tl ⇒ match eq_b8 b hd with - [ true ⇒ true - | false ⇒ test_not_impl_byte b tl - ] - ]. - -(* o e' non implementato? *) -nlet rec test_not_impl_pseudo (m:mcu_type) (o:aux_op_type m) (l:list (aux_op_type m)) on l ≝ - match l with - [ nil ⇒ false - | cons hd tl ⇒ match eq_op m o hd with - [ true ⇒ true - | false ⇒ test_not_impl_pseudo m o tl - ] - ]. - -(* i e' non implementato? *) -nlet rec test_not_impl_mode (m:mcu_type) (i:aux_im_type m) (l:list (aux_im_type m)) on l ≝ - match l with - [ nil ⇒ false - | cons hd tl ⇒ match eq_im m i hd with - [ true ⇒ true - | false ⇒ test_not_impl_mode m i tl - ] - ]. - -(* su tutta la lista quante volte compare la coppia opcode,instr_mode *) -nlet rec get_OpIm_count (m:mcu_type) (o:aux_op_type m) (i:aux_im_type m) (c:word16) (l:list (aux_table_type m)) on l ≝ - match l with - [ nil ⇒ c - | cons hd tl ⇒ - match (eq_op m o (fst4T … hd)) ⊗ - (eq_im m i (snd4T … hd)) with - [ true ⇒ get_OpIm_count m o i (succ_w16 c) tl - | false ⇒ get_OpIm_count m o i c tl - ] - ]. diff --git a/helm/software/matita/contribs/ng_assembly/universe/universe.ma b/helm/software/matita/contribs/ng_assembly/universe/universe.ma deleted file mode 100755 index 0db667a0f..000000000 --- a/helm/software/matita/contribs/ng_assembly/universe/universe.ma +++ /dev/null @@ -1,233 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The HELM team. *) -(* ||A|| http://helm.cs.unibo.it *) -(* \ / *) -(* \ / This file is distributed under the terms of the *) -(* v GNU General Public License Version 2 *) -(* *) -(**************************************************************************) - -(* ********************************************************************** *) -(* Progetto FreeScale *) -(* *) -(* Sviluppato da: Ing. Cosimo Oliboni, oliboni@cs.unibo.it *) -(* Sviluppo: 2008-2010 *) -(* *) -(* ********************************************************************** *) - -include "common/list.ma". -include "common/nat_lemmas.ma". -include "common/prod.ma". - -nlet rec nmember_natList (elem:nat) (l:ne_list nat) on l ≝ - match l with - [ ne_nil h ⇒ ⊖(eq_nat elem h) - | ne_cons h t ⇒ match eq_nat elem h with - [ true ⇒ false | false ⇒ nmember_natList elem t ] - ]. - -(* elem presente una ed una sola volta in l *) -nlet rec member_natList (elem:nat) (l:ne_list nat) on l ≝ - match l with - [ ne_nil h ⇒ eq_nat elem h - | ne_cons h t ⇒ match eq_nat elem h with - [ true ⇒ nmember_natList elem t | false ⇒ member_natList elem t ] - ]. - -(* costruttore di un sottouniverso: - S_EL cioe' uno qualsiasi degli elementi del sottouniverso -*) -ninductive S_UN (l:ne_list nat) : Type ≝ - S_EL : Πx:nat.((member_natList x l) = true) → S_UN l. - -ndefinition getelem : ∀l.∀e:S_UN l.nat. - #l; #s; nelim s; - #u; #dim; - napply u. -nqed. - -ndefinition eq_SUN ≝ λl.λx,y:S_UN l.eq_nat (getelem ? x) (getelem ? y). - -ndefinition getdim : ∀l.∀e:S_UN l.member_natList (getelem ? e) l = true. - #l; #s; nelim s; - #u; #dim; - napply dim. -nqed. - -nlemma SUN_destruct_1 - : ∀l.∀e1,e2.∀dim1,dim2.S_EL l e1 dim1 = S_EL l e2 dim2 → e1 = e2. - #l; #e1; #e2; #dim1; #dim2; #H; - nchange with (match S_EL l e2 dim2 with [ S_EL a _ ⇒ e1 = a ]); - nrewrite < H; - nnormalize; - napply refl_eq. -nqed. - -(* destruct universale *) -ndefinition SUN_destruct : ∀l.∀x,y:S_UN l.∀P:Prop.x = y → match eq_SUN l x y with [ true ⇒ P → P | false ⇒ P ]. - #l; #x; nelim x; - #u1; #dim1; - #y; nelim y; - #u2; #dim2; - #P; - nchange with (? → (match eq_nat u1 u2 with [ true ⇒ P → P | false ⇒ P ])); - #H; - nrewrite > (SUN_destruct_1 l … H); - nrewrite > (eq_to_eqnat u2 u2 (refl_eq …)); - nnormalize; - napply (λx.x). -nqed. - -(* eq_to_eqxx universale *) -nlemma eq_to_eqSUN : ∀l.∀x,y:S_UN l.x = y → eq_SUN l x y = true. - #l; #x; nelim x; - #u1; #dim1; - #y; nelim y; - #u2; #dim2; - nchange with (? → eq_nat u1 u2 = true); - #H; napply (eq_to_eqnat u1 u2); - napply (SUN_destruct_1 l … H). -nqed. - -(* neqxx_to_neq universale *) -nlemma neqSUN_to_neq : ∀l.∀x,y:S_UN l.eq_SUN l x y = false → x ≠ y. - #l; #n1; #n2; #H; - napply (not_to_not (n1 = n2) (eq_SUN l n1 n2 = true) …); - ##[ ##1: napply (eq_to_eqSUN l n1 n2) - ##| ##2: napply (eqfalse_to_neqtrue … H) - ##] -nqed. - -(* eqxx_to_eq universale *) -(* !!! evidente ma come si fa? *) -naxiom eqSUN_to_eq_aux : ∀l,x,y.((getelem l x) = (getelem l y)) → x = y. - -nlemma eqSUN_to_eq : ∀l.∀x,y:S_UN l.eq_SUN l x y = true → x = y. - #l; #x; #y; - nchange with ((eq_nat (getelem ? x) (getelem ? y) = true) → x = y); - #H; napply (eqSUN_to_eq_aux l x y (eqnat_to_eq … H)). -nqed. - -(* neq_to_neqxx universale *) -nlemma neq_to_neqSUN : ∀l.∀x,y:S_UN l.x ≠ y → eq_SUN l x y = false. - #l; #n1; #n2; #H; - napply (neqtrue_to_eqfalse (eq_SUN l n1 n2)); - napply (not_to_not (eq_SUN l n1 n2 = true) (n1 = n2) ? H); - napply (eqSUN_to_eq l n1 n2). -nqed. - -(* decidibilita' universale *) -nlemma decidable_SUN : ∀l.∀x,y:S_UN l.decidable (x = y). - #l; #x; #y; nnormalize; - napply (or2_elim (eq_SUN l x y = true) (eq_SUN l x y = false) ? (decidable_bexpr ?)); - ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqSUN_to_eq l … H)) - ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqSUN_to_neq l … H)) - ##] -nqed. - -(* simmetria di uguaglianza universale *) -nlemma symmetric_eqSUN : ∀l.symmetricT (S_UN l) bool (eq_SUN l). - #l; #n1; #n2; - napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_SUN l n1 n2)); - ##[ ##1: #H; nrewrite > H; napply refl_eq - ##| ##2: #H; nrewrite > (neq_to_neqSUN l n1 n2 H); - napply (symmetric_eq ? (eq_SUN l n2 n1) false); - napply (neq_to_neqSUN l n2 n1 (symmetric_neq ? n1 n2 H)) - ##] -nqed. - -(* scheletro di funzione generica ad 1 argomento *) -nlet rec farg1_auxT (T:Type) (l:ne_list nat) on l ≝ - match l with - [ ne_nil _ ⇒ T - | ne_cons _ t ⇒ ProdT T (farg1_auxT T t) - ]. - -nlemma farg1_auxDim : ∀h,t,x.eq_nat x h = false → member_natList x (h§§t) = true → member_natList x t = true. - #h; #t; #x; #H; #H1; - nnormalize in H1:(%); - nrewrite > H in H1:(%); - nnormalize; - napply (λx.x). -nqed. - -nlet rec farg1 (T:Type) (l:ne_list nat) on l ≝ - match l with - [ ne_nil h ⇒ λarg:farg1_auxT T «£h».λx:S_UN «£h».arg - | ne_cons h t ⇒ λarg:farg1_auxT T (h§§t).λx:S_UN (h§§t). - match eq_nat (getelem ? x) h - return λy.eq_nat (getelem ? x) h = y → ? - with - [ true ⇒ λp:(eq_nat (getelem ? x) h = true).fst … arg - | false ⇒ λp:(eq_nat (getelem ? x) h = false). - farg1 T t - (snd … arg) - (S_EL t (getelem ? x) (farg1_auxDim h t (getelem ? x) p (getdim ? x))) - ] (refl_eq ? (eq_nat (getelem ? x) h)) - ]. - -(* scheletro di funzione generica a 2 argomenti *) -nlet rec farg2 (T:Type) (l,lfix:ne_list nat) on l ≝ - match l with - [ ne_nil h ⇒ λarg:farg1_auxT (farg1_auxT T lfix) «£h».λx:S_UN «£h».farg1 T lfix arg - | ne_cons h t ⇒ λarg:farg1_auxT (farg1_auxT T lfix) (h§§t).λx:S_UN (h§§t). - match eq_nat (getelem ? x) h - return λy.eq_nat (getelem ? x) h = y → ? - with - [ true ⇒ λp:(eq_nat (getelem ? x) h = true).farg1 T lfix (fst … arg) - | false ⇒ λp:(eq_nat (getelem ? x) h = false). - farg2 T t lfix - (snd … arg) - (S_EL t (getelem ? x) (farg1_auxDim h t (getelem ? x) p (getdim ? x))) - ] (refl_eq ? (eq_nat (getelem ? x) h)) - ]. - -(* esempio0: universo ottale *) -ndefinition oct0 ≝ O. -ndefinition oct1 ≝ nat1. -ndefinition oct2 ≝ nat2. -ndefinition oct3 ≝ nat3. -ndefinition oct4 ≝ nat4. -ndefinition oct5 ≝ nat5. -ndefinition oct6 ≝ nat6. -ndefinition oct7 ≝ nat7. - -ndefinition oct_UN ≝ « oct0 ; oct1 ; oct2 ; oct3 ; oct4 ; oct5 ; oct6 £ oct7 ». - -ndefinition uoct0 ≝ S_EL oct_UN oct0 (refl_eq …). -ndefinition uoct1 ≝ S_EL oct_UN oct1 (refl_eq …). -ndefinition uoct2 ≝ S_EL oct_UN oct2 (refl_eq …). -ndefinition uoct3 ≝ S_EL oct_UN oct3 (refl_eq …). -ndefinition uoct4 ≝ S_EL oct_UN oct4 (refl_eq …). -ndefinition uoct5 ≝ S_EL oct_UN oct5 (refl_eq …). -ndefinition uoct6 ≝ S_EL oct_UN oct6 (refl_eq …). -ndefinition uoct7 ≝ S_EL oct_UN oct7 (refl_eq …). - -(* esempio1: NOT ottale *) -ndefinition octNOT ≝ - farg1 (S_UN oct_UN) oct_UN - (pair … uoct7 (pair … uoct6 (pair … uoct5 (pair … uoct4 (pair … uoct3 (pair … uoct2 (pair … uoct1 uoct0))))))). - -(* esempio2: AND ottale *) -ndefinition octAND0 ≝ pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct0 uoct0)))))). -ndefinition octAND1 ≝ pair … uoct0 (pair … uoct1 (pair … uoct0 (pair … uoct1 (pair … uoct0 (pair … uoct1 (pair … uoct0 uoct1)))))). -ndefinition octAND2 ≝ pair … uoct0 (pair … uoct0 (pair … uoct2 (pair … uoct2 (pair … uoct0 (pair … uoct0 (pair … uoct2 uoct2)))))). -ndefinition octAND3 ≝ pair … uoct0 (pair … uoct1 (pair … uoct2 (pair … uoct3 (pair … uoct0 (pair … uoct1 (pair … uoct2 uoct3)))))). -ndefinition octAND4 ≝ pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct0 (pair … uoct4 (pair … uoct4 (pair … uoct4 uoct4)))))). -ndefinition octAND5 ≝ pair … uoct0 (pair … uoct1 (pair … uoct0 (pair … uoct1 (pair … uoct4 (pair … uoct5 (pair … uoct4 uoct5)))))). -ndefinition octAND6 ≝ pair … uoct0 (pair … uoct0 (pair … uoct2 (pair … uoct2 (pair … uoct4 (pair … uoct4 (pair … uoct6 uoct6)))))). -ndefinition octAND7 ≝ pair … uoct0 (pair … uoct1 (pair … uoct2 (pair … uoct3 (pair … uoct4 (pair … uoct5 (pair … uoct6 uoct7)))))). - -ndefinition octAND ≝ - farg2 (S_UN oct_UN) oct_UN oct_UN - (pair … octAND0 (pair … octAND1 (pair … octAND2 (pair … octAND3 (pair … octAND4 (pair … octAND5 (pair … octAND6 octAND7))))))). - -(* ora e' possibile fare - octNOT uoctX - octAND uoctX uoctY -*) -- 2.39.2