From cacd19eb7ce2395301b31ed3932b4cd7c23ca90e Mon Sep 17 00:00:00 2001 From: Cosimo Oliboni Date: Fri, 5 Feb 2010 07:43:09 +0000 Subject: [PATCH] freescale porting --- .../contribs/ng_assembly2/common/prod.ma | 22 +- .../matita/contribs/ng_assembly2/depends | 100 +- .../emulator/memory/memory_abs.ma | 293 +++++ .../emulator/memory/memory_base.ma | 125 ++ .../emulator/memory/memory_bits.ma | 182 +++ .../emulator/memory/memory_func.ma | 83 ++ .../emulator/memory/memory_struct.ma | 1087 +++++++++++++++++ .../emulator/memory/memory_struct_base.ma | 191 +++ .../emulator/memory/memory_trees.ma | 128 ++ .../emulator/opcodes/HC05_table_tests.ma | 94 ++ .../emulator/opcodes/HC08_table_tests.ma | 123 ++ .../emulator/opcodes/HCS08_table_tests.ma | 118 ++ .../emulator/opcodes/IP2022_instr_mode.ma | 16 + .../emulator/opcodes/IP2022_table_tests.ma | 102 ++ .../emulator/opcodes/RS08_table_tests.ma | 78 ++ .../ng_assembly2/emulator/opcodes/pseudo.ma | 178 ++- .../emulator/status/HC05_status.ma | 352 ++++++ .../emulator/status/HC05_status_base.ma | 283 +++++ .../emulator/status/HC08_status.ma | 324 +++++ .../emulator/status/HC08_status_base.ma | 318 +++++ .../emulator/status/IP2022_status.ma | 416 +++++++ .../emulator/status/IP2022_status_base.ma | 585 +++++++++ .../emulator/status/RS08_status.ma | 256 ++++ .../emulator/status/RS08_status_base.ma | 183 +++ .../ng_assembly2/emulator/status/status.ma | 192 +++ .../emulator/status/status_base.ma | 171 +++ .../contribs/ng_assembly2/num/bitrigesim.ma | 504 ++++++++ .../matita/contribs/ng_assembly2/num/bool.ma | 4 +- .../contribs/ng_assembly2/num/bool_lemmas.ma | 17 + .../matita/contribs/ng_assembly2/num/byte8.ma | 3 + .../contribs/ng_assembly2/num/comp_num.ma | 15 +- .../matita/contribs/ng_assembly2/num/oct.ma | 5 + .../contribs/ng_assembly2/num/word16.ma | 4 + .../contribs/ng_assembly2/num/word32.ma | 5 + .../ng_assembly2/universe/universe.ma | 18 +- 35 files changed, 6483 insertions(+), 92 deletions(-) create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_abs.ma create mode 100644 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_bits.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_func.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_trees.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table_tests.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status_base.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/status.ma create mode 100755 helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma diff --git a/helm/software/matita/contribs/ng_assembly2/common/prod.ma b/helm/software/matita/contribs/ng_assembly2/common/prod.ma index 38852d1a9..5de6fb42e 100644 --- a/helm/software/matita/contribs/ng_assembly2/common/prod.ma +++ b/helm/software/matita/contribs/ng_assembly2/common/prod.ma @@ -186,7 +186,9 @@ nlemma pair_is_comparable : comparable → comparable → comparable. #T1; #T2; napply (mk_comparable (ProdT T1 T2)); ##[ napply (pair … (zeroc T1) (zeroc T2)) - ##| napply (λx.false) + ##| napply (λP.(forallc T1) + (λe1.(forallc T2) + (λe2.P (pair … e1 e2)))) ##| napply (eq_pair … (eqc T1) (eqc T2)) ##| napply (eqpair_to_eq … (eqc T1) (eqc T2)); ##[ napply (eqc_to_eq T1) @@ -428,7 +430,10 @@ nlemma triple_is_comparable : comparable → comparable → comparable → comparable. #T1; #T2; #T3; napply (mk_comparable (Prod3T T1 T2 T3)); ##[ napply (triple … (zeroc T1) (zeroc T2) (zeroc T3)) - ##| napply (λx.false) + ##| napply (λP.(forallc T1) + (λe1.(forallc T2) + (λe2.(forallc T3) + (λe3.P (triple … e1 e2 e3))))) ##| napply (eq_triple … (eqc T1) (eqc T2) (eqc T3)) ##| napply (eqtriple_to_eq … (eqc T1) (eqc T2) (eqc T3)); ##[ napply (eqc_to_eq T1) @@ -719,7 +724,11 @@ nlemma quadruple_is_comparable : comparable → comparable → comparable → comparable → comparable. #T1; #T2; #T3; #T4; napply (mk_comparable (Prod4T T1 T2 T3 T4)); ##[ napply (quadruple … (zeroc T1) (zeroc T2) (zeroc T3) (zeroc T4)) - ##| napply (λx.false) + ##| napply (λP.(forallc T1) + (λe1.(forallc T2) + (λe2.(forallc T3) + (λe3.(forallc T4) + (λe4.P (quadruple … e1 e2 e3 e4)))))) ##| napply (eq_quadruple … (eqc T1) (eqc T2) (eqc T3) (eqc T4)) ##| napply (eqquadruple_to_eq … (eqc T1) (eqc T2) (eqc T3) (eqc T4)); ##[ napply (eqc_to_eq T1) @@ -1059,7 +1068,12 @@ nlemma quintuple_is_comparable : comparable → comparable → comparable → comparable → comparable → comparable. #T1; #T2; #T3; #T4; #T5; napply (mk_comparable (Prod5T T1 T2 T3 T4 T5)); ##[ napply (quintuple … (zeroc T1) (zeroc T2) (zeroc T3) (zeroc T4) (zeroc T5)) - ##| napply (λx.false) + ##| napply (λP.(forallc T1) + (λe1.(forallc T2) + (λe2.(forallc T3) + (λe3.(forallc T4) + (λe4.(forallc T5) + (λe5.P (quintuple … e1 e2 e3 e4 e5))))))) ##| napply (eq_quintuple … (eqc T1) (eqc T2) (eqc T3) (eqc T4) (eqc T5)) ##| napply (eqquintuple_to_eq … (eqc T1) (eqc T2) (eqc T3) (eqc T4) (eqc T5)); ##[ napply (eqc_to_eq T1) diff --git a/helm/software/matita/contribs/ng_assembly2/depends b/helm/software/matita/contribs/ng_assembly2/depends index c4cf76ced..563104796 100644 --- a/helm/software/matita/contribs/ng_assembly2/depends +++ b/helm/software/matita/contribs/ng_assembly2/depends @@ -1,48 +1,74 @@ +emulator/status/status_base.ma emulator/memory/memory_abs.ma emulator/opcodes/pseudo.ma emulator/status/HC05_status.ma emulator/status/HC08_status.ma emulator/status/IP2022_status.ma emulator/status/RS08_status.ma +common/nelist.ma common/list.ma +emulator/opcodes/HC05_table_tests.ma emulator/opcodes/HC05_table.ma emulator/opcodes/pseudo.ma +emulator/opcodes/IP2022_instr_mode_base.ma num/bitrigesim.ma num/oct.ma +num/bool.ma common/theory.ma compiler/preast_tree.ma common/string.ma compiler/ast_type.ma num/word32.ma -num/word32.ma num/word16.ma +emulator/status/HC08_status.ma emulator/status/HC08_status_base.ma +compiler/ast_base_type_base.ma num/bool.ma common/nat.ma common/comp.ma num/bool_lemmas.ma -common/ascii_base.ma num/bool.ma -emulator/opcodes/HCS08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma -num/bitrigesim.ma common/comp.ma num/bool_lemmas.ma +emulator/opcodes/IP2022_pseudo.ma common/comp.ma emulator/opcodes/IP2022_pseudo_base.ma num/bool_lemmas.ma +num/exadecim.ma num/bool_lemmas.ma num/comp_ext.ma num/oct.ma +emulator/memory/memory_struct_base.ma num/byte8.ma +emulator/status/status.ma emulator/status/status_base.ma +num/byte8.ma num/bitrigesim.ma num/comp_num.ma num/exadecim.ma +emulator/opcodes/HC08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma +emulator/memory/memory_base.ma common/comp.ma num/bool_lemmas.ma emulator/opcodes/HC05_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma -emulator/opcodes/byte_or_word.ma num/word16.ma -emulator/opcodes/Freescale_pseudo_base.ma num/bool.ma +emulator/status/HC08_status_base.ma num/word16.ma +common/comp.ma common/hints_declaration.ma num/bool.ma +emulator/memory/memory_trees.ma common/list.ma emulator/memory/memory_base.ma emulator/memory/memory_struct.ma num/word32.ma +emulator/opcodes/Freescale_pseudo.ma common/comp.ma emulator/opcodes/Freescale_pseudo_base.ma num/bool_lemmas.ma +emulator/status/HC05_status_base.ma num/word16.ma common/pts.ma -compiler/ast_type_base.ma common/nelist.ma compiler/ast_base_type.ma +num/comp_ext.ma common/comp.ma common/prod.ma +common/ascii_base.ma num/bool.ma +emulator/opcodes/RS08_table_tests.ma emulator/opcodes/RS08_table.ma emulator/opcodes/pseudo.ma +compiler/environment.ma common/string.ma compiler/ast_type.ma +emulator/translation/translation_base.ma common/option.ma emulator/opcodes/HC05_table.ma emulator/opcodes/HC08_table.ma emulator/opcodes/HCS08_table.ma emulator/opcodes/IP2022_table.ma emulator/opcodes/RS08_table.ma emulator/opcodes/pseudo.ma +compiler/ast_base_type.ma common/comp.ma compiler/ast_base_type_base.ma num/bool_lemmas.ma +emulator/opcodes/IP2022_table.ma common/list.ma emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_pseudo.ma emulator/opcodes/byte_or_word.ma +emulator/status/HC05_status.ma emulator/status/HC05_status_base.ma +emulator/memory/memory_bits.ma emulator/memory/memory_trees.ma +common/string.ma common/ascii.ma common/list.ma +common/theory.ma common/pts.ma +emulator/opcodes/byte_or_word.ma num/word16.ma +compiler/ast_type.ma compiler/ast_type_base.ma +num/word16.ma common/nat.ma num/byte8.ma +emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_instr_mode_base.ma common/prod.ma common/comp.ma common/prod_base.ma num/bool_lemmas.ma -common/prod_base.ma num/bool.ma -universe/universe.ma common/nelist.ma common/prod.ma -num/bool_lemmas.ma num/bool.ma -emulator/opcodes/Freescale_instr_mode.ma common/comp.ma emulator/opcodes/Freescale_instr_mode_base.ma num/bool_lemmas.ma -num/exadecim.ma num/bool_lemmas.ma num/comp_ext.ma num/oct.ma -common/comp.ma common/hints_declaration.ma num/bool.ma num/word24.ma num/byte8.ma -emulator/opcodes/IP2022_pseudo.ma common/comp.ma emulator/opcodes/IP2022_pseudo_base.ma num/bool_lemmas.ma -common/theory.ma common/pts.ma -emulator/opcodes/Freescale_pseudo.ma common/comp.ma emulator/opcodes/Freescale_pseudo_base.ma num/bool_lemmas.ma -emulator/opcodes/HC08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma -emulator/opcodes/Freescale_instr_mode_base.ma num/bitrigesim.ma num/exadecim.ma +num/bool_lemmas.ma common/comp.ma num/bool.ma +emulator/memory/memory_abs.ma emulator/memory/memory_bits.ma emulator/memory/memory_func.ma emulator/memory/memory_trees.ma +emulator/status/IP2022_status_base.ma emulator/memory/memory_struct.ma num/word16.ma num/word24.ma +emulator/memory/memory_struct.ma emulator/memory/memory_struct_base.ma +num/word32.ma num/word16.ma +common/ascii.ma common/ascii_base.ma common/comp.ma num/bool_lemmas.ma +emulator/opcodes/HCS08_table_tests.ma emulator/opcodes/HCS08_table.ma emulator/opcodes/pseudo.ma +emulator/opcodes/IP2022_table_tests.ma emulator/opcodes/IP2022_table.ma emulator/opcodes/pseudo.ma +emulator/status/IP2022_status.ma emulator/status/IP2022_status_base.ma +emulator/translation/Freescale_translation.ma emulator/translation/translation_base.ma +emulator/memory/memory_func.ma common/list.ma emulator/memory/memory_base.ma num/word16.ma +emulator/opcodes/Freescale_instr_mode.ma common/comp.ma emulator/opcodes/Freescale_instr_mode_base.ma num/bool_lemmas.ma +emulator/status/RS08_status_base.ma num/word16.ma +emulator/status/RS08_status.ma emulator/status/RS08_status_base.ma +compiler/ast_type_base.ma common/nelist.ma compiler/ast_base_type.ma +common/prod_base.ma num/bool.ma +common/option_base.ma num/bool.ma +common/option.ma common/comp.ma common/option_base.ma num/bool_lemmas.ma emulator/opcodes/RS08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma +num/comp_num.ma num/bool_lemmas.ma num/comp_ext.ma common/sigma.ma common/theory.ma -num/oct.ma common/comp.ma num/bool_lemmas.ma -compiler/ast_base_type.ma common/comp.ma compiler/ast_base_type_base.ma num/bool_lemmas.ma -num/byte8.ma num/bitrigesim.ma num/comp_num.ma num/exadecim.ma +emulator/opcodes/HCS08_table.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/byte_or_word.ma +emulator/translation/IP2022_translation.ma emulator/translation/translation_base.ma +universe/universe.ma common/nelist.ma common/prod.ma +num/bitrigesim.ma common/comp.ma num/bool_lemmas.ma common/hints_declaration.ma common/pts.ma -common/option.ma common/comp.ma common/option_base.ma num/bool_lemmas.ma -num/bool.ma common/theory.ma -common/option_base.ma num/bool.ma -emulator/opcodes/IP2022_instr_mode_base.ma num/bitrigesim.ma num/oct.ma -compiler/ast_base_type_base.ma num/bool.ma -num/word16.ma common/nat.ma num/byte8.ma -compiler/environment.ma common/string.ma compiler/ast_type.ma -common/ascii.ma common/ascii_base.ma common/comp.ma num/bool_lemmas.ma emulator/opcodes/pseudo.ma common/list.ma emulator/opcodes/Freescale_instr_mode.ma emulator/opcodes/Freescale_pseudo.ma emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_pseudo.ma emulator/opcodes/byte_or_word.ma -common/string.ma common/ascii.ma common/list.ma -common/list.ma common/comp.ma common/nat.ma common/option.ma -compiler/ast_type.ma compiler/ast_type_base.ma -num/comp_num.ma num/bool_lemmas.ma num/comp_ext.ma -emulator/opcodes/IP2022_table.ma common/list.ma emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_pseudo.ma emulator/opcodes/byte_or_word.ma -num/comp_ext.ma common/comp.ma common/prod.ma -emulator/opcodes/IP2022_instr_mode.ma emulator/opcodes/IP2022_instr_mode_base.ma -common/nelist.ma common/list.ma +emulator/opcodes/Freescale_pseudo_base.ma num/bool.ma +emulator/translation/translation.ma emulator/translation/Freescale_translation.ma emulator/translation/IP2022_translation.ma +num/oct.ma common/comp.ma num/bool_lemmas.ma emulator/opcodes/IP2022_pseudo_base.ma num/bool.ma +common/list.ma common/comp.ma common/nat.ma common/option.ma +emulator/opcodes/Freescale_instr_mode_base.ma num/bitrigesim.ma num/exadecim.ma +emulator/opcodes/HC08_table_tests.ma emulator/opcodes/HC08_table.ma emulator/opcodes/pseudo.ma diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_abs.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_abs.ma new file mode 100755 index 000000000..f0bbfc9fc --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_abs.ma @@ -0,0 +1,293 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_func.ma". +include "emulator/memory/memory_trees.ma". +include "emulator/memory/memory_bits.ma". + +(* ********************************************* *) +(* ASTRAZIONE DALL'IMPLEMENTAZIONE DELLA MEMORIA *) +(* ********************************************* *) + +(* se si disattiva l'implementazione a funzione + la memoria diventa un'oggetto confrontabile! *) + +(* 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 ⇒ oct → word16 → byte8 + |*) MEM_TREE ⇒ aux_20B_type byte8 + | MEM_BITS ⇒ aux_20B_type (Array8T bool) + ]. + +(* ausiliario per il tipo del checker *) +ndefinition aux_chk_type ≝ +λt:memory_impl.match t with + [ (*MEM_FUNC ⇒ oct → word16 → memory_type + |*) MEM_TREE ⇒ aux_20B_type memory_type + | MEM_BITS ⇒ aux_20B_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 → oct → word16 → byte8 + with + [ (*MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + m + |*) MEM_TREE ⇒ λm:aux_mem_type MEM_TREE. + mt_visit ? m + | MEM_BITS ⇒ λm:aux_mem_type MEM_BITS. + λsel:oct.λaddr:word16. + byte8_of_bits (mt_visit ? m sel addr) + ]. + +(* unificazione del chk *) +ndefinition chk_get ≝ +λt:memory_impl. + match t + return λt.aux_chk_type t → oct → word16 → Array8T memory_type + with + [ (*MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC.λsel:oct.λaddr:word16. + match c sel 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.λsel:oct.λaddr:word16. + match mt_visit ? c sel 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 ⇒ mt_visit ? + ]. + +(* unificazione della lettura con chk: mem_read mem chk addr *) +ndefinition mem_read ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → aux_chk_type t → oct → word16 → option byte8 + with + [ (*MEM_FUNC ⇒ mf_mem_read + |*) MEM_TREE ⇒ mt_mem_read + | MEM_BITS ⇒ mb_mem_read + ]. + +(* 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 → oct → word16 → oct → option bool + with + [ (*MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + λc:aux_chk_type MEM_FUNC. + λsel:oct.λaddr:word16. + λo:oct. + opt_map … (mf_mem_read m c sel 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. + λsel:oct.λaddr:word16. + λo:oct. + opt_map … (mt_mem_read m c sel addr) + (λb.Some ? (getn_array8T o bool (bits_of_byte8 b))) + | MEM_BITS ⇒ mb_mem_read_bit + ]. + +(* unificazione della scrittura con chk: mem_update mem chk addr val *) +ndefinition mem_update ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → aux_chk_type t → oct → word16 → byte8 → option (aux_mem_type t) + with + [ (*MEM_FUNC ⇒ mf_mem_update + |*) MEM_TREE ⇒ mt_mem_update + | MEM_BITS ⇒ mb_mem_update + ]. + +(* 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 → oct → word16 → oct → bool → option (aux_mem_type t) + with + [ (*MEM_FUNC ⇒ λm:aux_mem_type MEM_FUNC. + λc:aux_chk_type MEM_FUNC. + λsel:oct.λaddr:word16. + λo:oct. + λv:bool. + mf_mem_update m c sel 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. + λsel:oct.λaddr:word16. + λo:oct. + λv:bool. + mt_mem_update m c sel addr (byte8_of_bits (setn_array8T o bool (bits_of_byte8 (mt_visit ? m sel addr)) v)) + | MEM_BITS ⇒ mb_mem_update_bit + ]. + +(* unificazione del caricamento: load_from_source_at old_mem source addr *) +ndefinition load_from_source_at ≝ +λt:memory_impl. + match t + return λt.aux_mem_type t → list byte8 → oct → word16 → 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 + ]. + +(* 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 → oct → word16 → word16 → memory_type → aux_chk_type t + with + [ (*MEM_FUNC ⇒ mf_check_update_ranged + |*) MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. + λsel:oct.λaddr:word16. + λrange:word16. + mt_update_ranged ? c sel addr ? (w16_to_recw16 range) + | MEM_BITS ⇒ λc:aux_chk_type MEM_BITS. + λsel:oct.λaddr:word16. + λrange:word16. + λv:memory_type. + mt_update_ranged ? c sel 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 → oct → word16 → oct → memory_type → aux_chk_type t + with + [ (*MEM_FUNC ⇒ λc:aux_chk_type MEM_FUNC. + λsel:oct.λaddr:word16. + λo:oct. + λv:memory_type. + c + |*) MEM_TREE ⇒ λc:aux_chk_type MEM_TREE. + λsel:oct.λaddr:word16. + λo:oct. + λv:memory_type. + c + | MEM_BITS ⇒ mb_chk_update_bit + ]. + +ndefinition mem_is_comparable: memory_impl → comparable. + #m; @ (aux_mem_type m) + ##[ nelim m; + ##[ napply mt_zero_memory + ##| napply mb_zero_memory ##] + ##| nelim m; + ##[ napply (forallc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (forallc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eqc_to_eq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (eqc_to_eq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eq_to_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (eq_to_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (neqc_to_neq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (neqc_to_neq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (neq_to_neqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (neq_to_neqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (decidable_c (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (decidable_c (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (symmetric_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable byte8_is_comparable)))))) + ##| napply (symmetric_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable bool_is_comparable))))))) ##] + ##] +nqed. + +unification hint 0 ≔ M:memory_impl ⊢ carr (mem_is_comparable M) ≡ aux_mem_type M. + +ndefinition chk_is_comparable: memory_impl → comparable. + #m; @ (aux_chk_type m) + ##[ nelim m; + ##[ napply mt_out_of_bound_memory + ##| napply mb_out_of_bound_memory ##] + ##| nelim m; + ##[ napply (forallc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (forallc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eqc_to_eq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (eqc_to_eq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (eq_to_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (eq_to_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (neqc_to_neq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (neqc_to_neq (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (neq_to_neqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (neq_to_neqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (decidable_c (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (decidable_c (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##| nelim m; + ##[ napply (symmetric_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable memorytype_is_comparable)))))) + ##| napply (symmetric_eqc (ar8_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar16_is_comparable (ar8_is_comparable memorytype_is_comparable))))))) ##] + ##] +nqed. + +unification hint 0 ≔ M:memory_impl ⊢ carr (chk_is_comparable M) ≡ aux_chk_type M. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_base.ma new file mode 100644 index 000000000..225eea036 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_base.ma @@ -0,0 +1,125 @@ +(**************************************************************************) +(* ___ *) +(* ||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/comp.ma". +include "num/bool_lemmas.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. + +(* iteratore sugli ottali *) +ndefinition forall_memory_type ≝ λP. + P MEM_READ_ONLY ⊗ P MEM_READ_WRITE ⊗ P MEM_OUT_OF_BOUND. + +(* operatore = *) +ndefinition eq_memorytype ≝ +λm1,m2.match m1 with + [ MEM_READ_ONLY ⇒ match m2 with [ MEM_READ_ONLY ⇒ true | _ ⇒ false ] + | MEM_READ_WRITE ⇒ match m2 with [ MEM_READ_WRITE ⇒ true | _ ⇒ false ] + | MEM_OUT_OF_BOUND ⇒ match m2 with [ MEM_OUT_OF_BOUND ⇒ true | _ ⇒ false ] + ]. + +ndefinition memorytype_destruct_aux ≝ +Πn1,n2:memory_type.ΠP:Prop.n1 = n2 → + match eq_memorytype n1 n2 with [ true ⇒ P → P | false ⇒ P ]. + +ndefinition memorytype_destruct : memorytype_destruct_aux. + #n1; #n2; #P; #H; + nrewrite < H; + nelim n1; + nnormalize; + napply (λx.x). +nqed. + +nlemma eq_to_eqmemorytype : ∀n1,n2.n1 = n2 → eq_memorytype n1 n2 = true. + #n1; #n2; #H; + nrewrite > H; + nelim n2; + nnormalize; + napply refl_eq. +nqed. + +nlemma neqmemorytype_to_neq : ∀n1,n2.eq_memorytype n1 n2 = false → n1 ≠ n2. + #n1; #n2; #H; + napply (not_to_not (n1 = n2) (eq_memorytype n1 n2 = true) …); + ##[ ##1: napply (eq_to_eqmemorytype n1 n2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqmemorytype_to_eq : ∀n1,n2.eq_memorytype n1 n2 = true → n1 = n2. + #n1; #n2; + ncases n1; + ncases n2; + nnormalize; + ##[ ##1,5,9: #H; napply refl_eq + ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) + ##] +nqed. + +nlemma neq_to_neqmemorytype : ∀n1,n2.n1 ≠ n2 → eq_memorytype n1 n2 = false. + #n1; #n2; #H; + napply (neqtrue_to_eqfalse (eq_memorytype n1 n2)); + napply (not_to_not (eq_memorytype n1 n2 = true) (n1 = n2) ? H); + napply (eqmemorytype_to_eq n1 n2). +nqed. + +nlemma decidable_memorytype : ∀x,y:memory_type.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_memorytype x y = true) (eq_memorytype x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqmemorytype_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqmemorytype_to_neq … H)) + ##] +nqed. + +nlemma symmetric_eqmemorytype : symmetricT memory_type bool eq_memorytype. + #n1; #n2; + napply (or2_elim (n1 = n2) (n1 ≠ n2) ? (decidable_memorytype n1 n2)); + ##[ ##1: #H; nrewrite > H; napply refl_eq + ##| ##2: #H; nrewrite > (neq_to_neqmemorytype n1 n2 H); + napply (symmetric_eq ? (eq_memorytype n2 n1) false); + napply (neq_to_neqmemorytype n2 n1 (symmetric_neq ? n1 n2 H)) + ##] +nqed. + +nlemma memorytype_is_comparable : comparable. + @ memory_type + ##[ napply MEM_READ_ONLY + ##| napply forall_memory_type + ##| napply eq_memorytype + ##| napply eqmemorytype_to_eq + ##| napply eq_to_eqmemorytype + ##| napply neqmemorytype_to_neq + ##| napply neq_to_neqmemorytype + ##| napply decidable_memorytype + ##| napply symmetric_eqmemorytype + ##] +nqed. + +unification hint 0 ≔ ⊢ carr memorytype_is_comparable ≡ memory_type. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_bits.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_bits.ma new file mode 100755 index 000000000..7a7508164 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_bits.ma @@ -0,0 +1,182 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_trees.ma". + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +(* tutta la memoria non installata *) +ndefinition mb_out_of_bound_memory ≝ + aux_20B_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_20B_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_20B_type (Array8T bool). +λchk:aux_20B_type (Array8T memory_type). +λsel:oct.λaddr:word16.λsub:oct.λv:bool. + match getn_array8T sub ? (mt_visit ? chk sel addr) with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? mem + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (mt_update ? mem sel addr (setn_array8T sub ? (mt_visit ? mem sel addr) v)) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +ndefinition mb_mem_update ≝ +λmem:aux_20B_type (Array8T bool). +λchk:aux_20B_type (Array8T memory_type). +λsel:oct.λaddr:word16.λv:byte8. +let old_value ≝ mt_visit (Array8T bool) mem sel addr in +let new_value ≝ bits_of_byte8 v in +let memtypes ≝ mt_visit (Array8T memory_type) chk sel 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 sel addr (mk_Array8T bool nb7 nb6 nb5 nb4 nb3 nb2 nb1 nb0)))))))))). + +(* scrivi tipo di bit *) +ndefinition mb_chk_update_bit ≝ +λchk:aux_20B_type (Array8T memory_type). +λsel:oct.λaddr:word16.λsub:oct.λv:memory_type. + mt_update ? chk sel addr (setn_array8T sub ? (mt_visit ? chk sel addr) v). + +(* leggi bit controllando il tipo di memoria *) +ndefinition mb_mem_read_bit ≝ +λmem:aux_20B_type (Array8T bool). +λchk:aux_20B_type (Array8T memory_type). +λsel:oct.λaddr:word16.λsub:oct. + match getn_array8T sub ? (mt_visit ? chk sel addr) with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? (getn_array8T sub ? (mt_visit ? mem sel addr)) + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (getn_array8T sub ? (mt_visit ? mem sel 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_20B_type (Array8T bool). +λchk:aux_20B_type (Array8T memory_type). +λsel:oct.λaddr:word16. +let value ≝ mt_visit (Array8T bool) mem sel addr in +let memtypes ≝ mt_visit (Array8T memory_type) chk sel 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_20B_type (Array8T bool)) + (src:list byte8) (sel:oct) (addr:word16) 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 sel addr (bits_of_byte8 hd)) + tl sel (succc ? addr) + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_func.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_func.ma new file mode 100755 index 000000000..fda440e77 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_func.ma @@ -0,0 +1,83 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_base.ma". +include "num/word16.ma". +include "common/list.ma". + +(* ************************** *) +(* 8 segmenti da 64Kb → 512Kb *) +(* ************************** *) + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +(* (mf_check_update_ranged chk inf sup mode) = setta tipo memoria *) +ndefinition mf_check_update_ranged ≝ +λf:oct → word16 → memory_type.λsel:oct.λaddr:word16.λrange:word16.λv. + λx,y. + match (eqc ? sel x)⊗(inrangec ? y addr (plusc_d_d ? addr range)) with + [ true ⇒ v + | false ⇒ f x y ]. + +(* tutta la memoria non installata *) +ndefinition mf_out_of_bound_memory ≝ λ_:oct.λ_:word16.MEM_OUT_OF_BOUND. + +(* (mf_mem_update mem checked addr val) = scrivi controllando il tipo di memoria *) +ndefinition mf_mem_update ≝ +λf:oct → word16 → byte8.λc:oct → word16 → memory_type.λsel:oct.λa:word16.λv:byte8. + match c sel a with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? f + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (λx,y.match (eqc ? sel x)⊗(eqc ? a y) with [ true ⇒ v | false ⇒ f x y ]) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* tutta la memoria a 0 *) +ndefinition mf_zero_memory ≝ λ_:oct.λ_:word16.〈x0,x0〉. + +(* (mf_mem_read mem check addr) = leggi controllando il tipo di memoria *) +ndefinition mf_mem_read ≝ +λf:oct → word16 → byte8.λc:oct → word16 → memory_type.λsel:oct.λa:word16. + match c sel a with + [ MEM_READ_ONLY ⇒ Some ? (f sel a) + | MEM_READ_WRITE ⇒ Some ? (f sel 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:oct → word16 → byte8) (src:list byte8) (sel:oct) (addr:word16) on src ≝ + match src with + (* fine di source: carica da old_mem *) + [ nil ⇒ old_mem + | cons hd tl ⇒ λx,y.match (eqc ? sel x)⊗(eqc ? addr y) 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 sel (succc ? addr)) x y + ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct.ma new file mode 100755 index 000000000..8c0b88f99 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct.ma @@ -0,0 +1,1087 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_struct_base.ma". + +(* **************** *) +(* TIPO ARRAY DA 16 *) +(* **************** *) + +nlemma ar16_destruct_1 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x1 = y1. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T a _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x1 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_2 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x2 = y2. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ a _ _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x2 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_3 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x3 = y3. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ a _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x3 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_4 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x4 = y4. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ a _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x4 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_5 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x5 = y5. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ a _ _ _ _ _ _ _ _ _ _ _ ⇒ x5 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_6 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x6 = y6. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ a _ _ _ _ _ _ _ _ _ _ ⇒ x6 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_7 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x7 = y7. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ a _ _ _ _ _ _ _ _ _ ⇒ x7 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_8 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x8 = y8. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ a _ _ _ _ _ _ _ _ ⇒ x8 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_9 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x9 = y9. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ a _ _ _ _ _ _ _ ⇒ x9 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_10 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x10 = y10. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ a _ _ _ _ _ _ ⇒ x10 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_11 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x11 = y11. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ a _ _ _ _ _ ⇒ x11 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_12 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x12 = y12. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ _ a _ _ _ _ ⇒ x12 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_13 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x13 = y13. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ _ _ a _ _ _ ⇒ x13 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_14 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x14 = y14. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ _ _ _ a _ _ ⇒ x14 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_15 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x15 = y15. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ _ _ _ _ a _ ⇒ x15 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar16_destruct_16 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x16 = y16. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_Array16T _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ a ⇒ x16 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma symmetric_eqar16 : +∀T.∀f:T → T → bool. + (symmetricT T bool f) → + (symmetricT (Array16T T) bool (eq_ar16 T f)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nchange with ( + ((f x1 y1) ⊗ (f x2 y2) ⊗ (f x3 y3) ⊗ (f x4 y4) ⊗ + (f x5 y5) ⊗ (f x6 y6) ⊗ (f x7 y7) ⊗ (f x8 y8) ⊗ + (f x9 y9) ⊗ (f x10 y10) ⊗ (f x11 y11) ⊗ (f x12 y12) ⊗ + (f x13 y13) ⊗ (f x14 y14) ⊗ (f x15 y15) ⊗ (f x16 y16)) = + ((f y1 x1) ⊗ (f y2 x2) ⊗ (f y3 x3) ⊗ (f y4 x4) ⊗ + (f y5 x5) ⊗ (f y6 x6) ⊗ (f y7 x7) ⊗ (f y8 x8) ⊗ + (f y9 x9) ⊗ (f y10 x10) ⊗ (f y11 x11) ⊗ (f y12 x12) ⊗ + (f y13 x13) ⊗ (f y14 x14) ⊗ (f y15 x15) ⊗ (f y16 x16))); + nrewrite > (H x1 y1); + nrewrite > (H x2 y2); + nrewrite > (H x3 y3); + nrewrite > (H x4 y4); + nrewrite > (H x5 y5); + nrewrite > (H x6 y6); + nrewrite > (H x7 y7); + nrewrite > (H x8 y8); + nrewrite > (H x9 y9); + nrewrite > (H x10 y10); + nrewrite > (H x11 y11); + nrewrite > (H x12 y12); + nrewrite > (H x13 y13); + nrewrite > (H x14 y14); + nrewrite > (H x15 y15); + nrewrite > (H x16 y16); + napply refl_eq. +nqed. + +nlemma eqar16_to_eq : +∀T.∀f:T → T → bool. + (∀x,y.(f x y = true) → (x = y)) → + (∀a1,a2:Array16T T.(eq_ar16 T f a1 a2 = true) → (a1 = a2)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H1; + nchange in H1:(%) with ( + ((f x1 y1) ⊗ (f x2 y2) ⊗ (f x3 y3) ⊗ (f x4 y4) ⊗ + (f x5 y5) ⊗ (f x6 y6) ⊗ (f x7 y7) ⊗ (f x8 y8) ⊗ + (f x9 y9) ⊗ (f x10 y10) ⊗ (f x11 y11) ⊗ (f x12 y12) ⊗ + (f x13 y13) ⊗ (f x14 y14) ⊗ (f x15 y15) ⊗ (f x16 y16)) = true); + nrewrite > (H … (andb_true_true_r … H1)); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (H … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (H … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (H … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (H … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (H … (andb_true_true_r … H6)); + nletin H7 ≝ (andb_true_true_l … H6); + nrewrite > (H … (andb_true_true_r … H7)); + nletin H8 ≝ (andb_true_true_l … H7); + nrewrite > (H … (andb_true_true_r … H8)); + nletin H9 ≝ (andb_true_true_l … H8); + nrewrite > (H … (andb_true_true_r … H9)); + nletin H10 ≝ (andb_true_true_l … H9); + nrewrite > (H … (andb_true_true_r … H10)); + nletin H11 ≝ (andb_true_true_l … H10); + nrewrite > (H … (andb_true_true_r … H11)); + nletin H12 ≝ (andb_true_true_l … H11); + nrewrite > (H … (andb_true_true_r … H12)); + nletin H13 ≝ (andb_true_true_l … H12); + nrewrite > (H … (andb_true_true_r … H13)); + nletin H14 ≝ (andb_true_true_l … H13); + nrewrite > (H … (andb_true_true_r … H14)); + nletin H15 ≝ (andb_true_true_l … H14); + nrewrite > (H … (andb_true_true_r … H15)); + nrewrite > (H … (andb_true_true_l … H15)); + napply refl_eq. +nqed. + +nlemma eq_to_eqar16 : +∀T.∀f:T → T → bool. + (∀x,y.(x = y) → (f x y = true)) → + (∀a1,a2:Array16T T.(a1 = a2) → (eq_ar16 T f a1 a2 = true)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H1; + nrewrite > (ar16_destruct_1 … H1); + nrewrite > (ar16_destruct_2 … H1); + nrewrite > (ar16_destruct_3 … H1); + nrewrite > (ar16_destruct_4 … H1); + nrewrite > (ar16_destruct_5 … H1); + nrewrite > (ar16_destruct_6 … H1); + nrewrite > (ar16_destruct_7 … H1); + nrewrite > (ar16_destruct_8 … H1); + nrewrite > (ar16_destruct_9 … H1); + nrewrite > (ar16_destruct_10 … H1); + nrewrite > (ar16_destruct_11 … H1); + nrewrite > (ar16_destruct_12 … H1); + nrewrite > (ar16_destruct_13 … H1); + nrewrite > (ar16_destruct_14 … H1); + nrewrite > (ar16_destruct_15 … H1); + nrewrite > (ar16_destruct_16 … H1); + nchange with ( + ((f y1 y1) ⊗ (f y2 y2) ⊗ (f y3 y3) ⊗ (f y4 y4) ⊗ + (f y5 y5) ⊗ (f y6 y6) ⊗ (f y7 y7) ⊗ (f y8 y8) ⊗ + (f y9 y9) ⊗ (f y10 y10) ⊗ (f y11 y11) ⊗ (f y12 y12) ⊗ + (f y13 y13) ⊗ (f y14 y14) ⊗ (f y15 y15) ⊗ (f y16 y16)) = true); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + napply refl_eq. +nqed. + +nlemma decidable_ar16_aux1 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x1 ≠ y1) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_1 … H1)). +nqed. + +nlemma decidable_ar16_aux2 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x2 ≠ y2) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_2 … H1)). +nqed. + +nlemma decidable_ar16_aux3 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x3 ≠ y3) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_3 … H1)). +nqed. + +nlemma decidable_ar16_aux4 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x4 ≠ y4) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_4 … H1)). +nqed. + +nlemma decidable_ar16_aux5 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x5 ≠ y5) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_5 … H1)). +nqed. + +nlemma decidable_ar16_aux6 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x6 ≠ y6) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_6 … H1)). +nqed. + +nlemma decidable_ar16_aux7 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x7 ≠ y7) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_7 … H1)). +nqed. + +nlemma decidable_ar16_aux8 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x8 ≠ y8) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_8 … H1)). +nqed. + +nlemma decidable_ar16_aux9 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x9 ≠ y9) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_9 … H1)). +nqed. + +nlemma decidable_ar16_aux10 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x10 ≠ y10) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_10 … H1)). +nqed. + +nlemma decidable_ar16_aux11 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x11 ≠ y11) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_11 … H1)). +nqed. + +nlemma decidable_ar16_aux12 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x12 ≠ y12) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_12 … H1)). +nqed. + +nlemma decidable_ar16_aux13 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x13 ≠ y13) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_13 … H1)). +nqed. + +nlemma decidable_ar16_aux14 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x14 ≠ y14) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_14 … H1)). +nqed. + +nlemma decidable_ar16_aux15 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x15 ≠ y15) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_15 … H1)). +nqed. + +nlemma decidable_ar16_aux16 : +∀T. +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16:T. +∀y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16:T. + (x16 ≠ y16) → + (mk_Array16T T x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16) ≠ + (mk_Array16T T y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; #H; #H1; + napply (H (ar16_destruct_16 … H1)). +nqed. + +nlemma decidable_ar16 : +∀T.(∀x,y:T.decidable (x = y)) → + (∀a1,a2:Array16T T.decidable (a1 = a2)). + #T; #H; + #x; nelim x; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y; nelim y; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nnormalize; + napply (or2_elim (? = ?) (? ≠ ?) ? (H x1 y1) …); + ##[ ##2: #H1; napply (or2_intro2 … (decidable_ar16_aux1 T … H1)) + ##| ##1: #H1; napply (or2_elim (? = ?) (? ≠ ?) ? (H x2 y2) …); + ##[ ##2: #H2; napply (or2_intro2 … (decidable_ar16_aux2 T … H2)) + ##| ##1: #H2; napply (or2_elim (? = ?) (? ≠ ?) ? (H x3 y3) …); + ##[ ##2: #H3; napply (or2_intro2 … (decidable_ar16_aux3 T … H3)) + ##| ##1: #H3; napply (or2_elim (? = ?) (? ≠ ?) ? (H x4 y4) …); + ##[ ##2: #H4; napply (or2_intro2 … (decidable_ar16_aux4 T … H4)) + ##| ##1: #H4; napply (or2_elim (? = ?) (? ≠ ?) ? (H x5 y5) …); + ##[ ##2: #H5; napply (or2_intro2 … (decidable_ar16_aux5 T … H5)) + ##| ##1: #H5; napply (or2_elim (? = ?) (? ≠ ?) ? (H x6 y6) …); + ##[ ##2: #H6; napply (or2_intro2 … (decidable_ar16_aux6 T … H6)) + ##| ##1: #H6; napply (or2_elim (? = ?) (? ≠ ?) ? (H x7 y7) …); + ##[ ##2: #H7; napply (or2_intro2 … (decidable_ar16_aux7 T … H7)) + ##| ##1: #H7; napply (or2_elim (? = ?) (? ≠ ?) ? (H x8 y8) …); + ##[ ##2: #H8; napply (or2_intro2 … (decidable_ar16_aux8 T … H8)) + ##| ##1: #H8; napply (or2_elim (? = ?) (? ≠ ?) ? (H x9 y9) …); + ##[ ##2: #H9; napply (or2_intro2 … (decidable_ar16_aux9 T … H9)) + ##| ##1: #H9; napply (or2_elim (? = ?) (? ≠ ?) ? (H x10 y10) …); + ##[ ##2: #H10; napply (or2_intro2 … (decidable_ar16_aux10 T … H10)) + ##| ##1: #H10; napply (or2_elim (? = ?) (? ≠ ?) ? (H x11 y11) …); + ##[ ##2: #H11; napply (or2_intro2 … (decidable_ar16_aux11 T … H11)) + ##| ##1: #H11; napply (or2_elim (? = ?) (? ≠ ?) ? (H x12 y12) …); + ##[ ##2: #H12; napply (or2_intro2 … (decidable_ar16_aux12 T … H12)) + ##| ##1: #H12; napply (or2_elim (? = ?) (? ≠ ?) ? (H x13 y13) …); + ##[ ##2: #H13; napply (or2_intro2 … (decidable_ar16_aux13 T … H13)) + ##| ##1: #H13; napply (or2_elim (? = ?) (? ≠ ?) ? (H x14 y14) …); + ##[ ##2: #H14; napply (or2_intro2 … (decidable_ar16_aux14 T … H14)) + ##| ##1: #H14; napply (or2_elim (? = ?) (? ≠ ?) ? (H x15 y15) …); + ##[ ##2: #H15; napply (or2_intro2 … (decidable_ar16_aux15 T … H15)) + ##| ##1: #H15; napply (or2_elim (? = ?) (? ≠ ?) ? (H x16 y16) …); + ##[ ##2: #H16; napply (or2_intro2 … (decidable_ar16_aux16 T … H16)) + ##| ##1: #H16; nrewrite > H1; nrewrite > H2; nrewrite > H3; nrewrite > H4; + nrewrite > H5; nrewrite > H6; nrewrite > H7; nrewrite > H8; + nrewrite > H9; nrewrite > H10; nrewrite > H11; nrewrite > H12; + nrewrite > H13; nrewrite > H14; nrewrite > H15; nrewrite > H16; + napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] +nqed. + +(* !!! per brevita *) +naxiom neqar16_to_neq : +∀T.∀f:T → T → bool. + (∀x,y:T.f x y = false → x ≠ y) → + (∀p1,p2:Array16T T.(eq_ar16 T f p1 p2 = false → p1 ≠ p2)). + +(* !!! per brevita *) +naxiom neq_to_neqar16 : +∀T.∀f:T → T → bool. + (∀x,y:T.decidable (x = y)) → + (∀x,y:T.x ≠ y → f x y = false) → + (∀p1,p2:Array16T T.(p1 ≠ p2 → eq_ar16 T f p1 p2 = false)). + +nlemma ar16_is_comparable : comparable → comparable. + #T; @ (Array16T T) + ##[ napply (mk_Array16T ? (zeroc T) (zeroc T) (zeroc T) (zeroc T) + (zeroc T) (zeroc T) (zeroc T) (zeroc T) + (zeroc T) (zeroc T) (zeroc T) (zeroc T) + (zeroc T) (zeroc T) (zeroc T) (zeroc T)) + ##| napply (λP.(forallc T) + (λe1.(forallc T) + (λe2.(forallc T) + (λe3.(forallc T) + (λe4.(forallc T) + (λe5.(forallc T) + (λe6.(forallc T) + (λe7.(forallc T) + (λe8.(forallc T) + (λe9.(forallc T) + (λe10.(forallc T) + (λe11.(forallc T) + (λe12.(forallc T) + (λe13.(forallc T) + (λe14.(forallc T) + (λe15.(forallc T) + (λe16.P (mk_Array16T T e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11 e12 e13 e14 e15 e16)))))))))))))))))) + ##| napply (eq_ar16 … (eqc T)) + ##| napply eqar16_to_eq; + napply (eqc_to_eq T) + ##| napply eq_to_eqar16; + napply (eq_to_eqc T) + ##| napply neqar16_to_neq; + napply (neqc_to_neq T) + ##| napply neq_to_neqar16; + ##[ napply (decidable_c T) + ##| napply (neq_to_neqc T) ##] + ##| napply decidable_ar16; + napply (decidable_c T) + ##| napply symmetric_eqar16; + napply (symmetric_eqc T) + ##] +nqed. + +unification hint 0 ≔ S: comparable ; + T ≟ (carr S), + X ≟ (ar16_is_comparable S) + (*********************************************) ⊢ + carr X ≡ Array16T T. + +(* *************** *) +(* TIPO ARRAY DA 8 *) +(* *************** *) + +nlemma ar8_destruct_1 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x1 = y1. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T a _ _ _ _ _ _ _ ⇒ x1 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_2 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x2 = y2. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ a _ _ _ _ _ _ ⇒ x2 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_3 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x3 = y3. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ a _ _ _ _ _ ⇒ x3 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_4 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x4 = y4. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ _ a _ _ _ _ ⇒ x4 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_5 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x5 = y5. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ _ _ a _ _ _ ⇒ x5 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_6 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x6 = y6. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ _ _ _ a _ _ ⇒ x6 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_7 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x7 = y7. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ _ _ _ _ a _ ⇒ x7 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma ar8_destruct_8 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8:T.∀y1,y2,y3,y4,y5,y6,y7,y8:T. + mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8 = mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 → + x8 = y8. + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H; + nchange with (match mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8 + with [ mk_Array8T _ _ _ _ _ _ _ a ⇒ x8 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma symmetric_eqar8 : +∀T.∀f:T → T → bool. + (symmetricT T bool f) → + (symmetricT (Array8T T) bool (eq_ar8 T f)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nchange with ( + ((f x1 y1) ⊗ (f x2 y2) ⊗ (f x3 y3) ⊗ (f x4 y4) ⊗ + (f x5 y5) ⊗ (f x6 y6) ⊗ (f x7 y7) ⊗ (f x8 y8)) = + ((f y1 x1) ⊗ (f y2 x2) ⊗ (f y3 x3) ⊗ (f y4 x4) ⊗ + (f y5 x5) ⊗ (f y6 x6) ⊗ (f y7 x7) ⊗ (f y8 x8))); + nrewrite > (H x1 y1); + nrewrite > (H x2 y2); + nrewrite > (H x3 y3); + nrewrite > (H x4 y4); + nrewrite > (H x5 y5); + nrewrite > (H x6 y6); + nrewrite > (H x7 y7); + nrewrite > (H x8 y8); + napply refl_eq. +nqed. + +nlemma eqar8_to_eq : +∀T.∀f:T → T → bool. + (∀x,y.(f x y = true) → (x = y)) → + (∀a1,a2:Array8T T.(eq_ar8 T f a1 a2 = true) → (a1 = a2)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H1; + nchange in H1:(%) with ( + ((f x1 y1) ⊗ (f x2 y2) ⊗ (f x3 y3) ⊗ (f x4 y4) ⊗ + (f x5 y5) ⊗ (f x6 y6) ⊗ (f x7 y7) ⊗ (f x8 y8)) = true); + nrewrite > (H … (andb_true_true_r … H1)); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (H … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (H … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (H … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (H … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (H … (andb_true_true_r … H6)); + nletin H7 ≝ (andb_true_true_l … H6); + nrewrite > (H … (andb_true_true_r … H7)); + nrewrite > (H … (andb_true_true_l … H7)); + napply refl_eq. +nqed. + +nlemma eq_to_eqar8 : +∀T.∀f:T → T → bool. + (∀x,y.(x = y) → (f x y = true)) → + (∀a1,a2:Array8T T.(a1 = a2) → (eq_ar8 T f a1 a2 = true)). + #T; #f; #H; + #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #H1; + nrewrite > (ar8_destruct_1 … H1); + nrewrite > (ar8_destruct_2 … H1); + nrewrite > (ar8_destruct_3 … H1); + nrewrite > (ar8_destruct_4 … H1); + nrewrite > (ar8_destruct_5 … H1); + nrewrite > (ar8_destruct_6 … H1); + nrewrite > (ar8_destruct_7 … H1); + nrewrite > (ar8_destruct_8 … H1); + nchange with ( + ((f y1 y1) ⊗ (f y2 y2) ⊗ (f y3 y3) ⊗ (f y4 y4) ⊗ + (f y5 y5) ⊗ (f y6 y6) ⊗ (f y7 y7) ⊗ (f y8 y8)) = true); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + nrewrite > (H … (refl_eq …)); + napply refl_eq. +nqed. + +nlemma decidable_ar8_aux1 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x1 ≠ y1) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_1 … H1)). +nqed. + +nlemma decidable_ar8_aux2 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x2 ≠ y2) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_2 … H1)). +nqed. + +nlemma decidable_ar8_aux3 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x3 ≠ y3) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_3 … H1)). +nqed. + +nlemma decidable_ar8_aux4 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x4 ≠ y4) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_4 … H1)). +nqed. + +nlemma decidable_ar8_aux5 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x5 ≠ y5) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_5 … H1)). +nqed. + +nlemma decidable_ar8_aux6 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x6 ≠ y6) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_6 … H1)). +nqed. + +nlemma decidable_ar8_aux7 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x7 ≠ y7) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_7 … H1)). +nqed. + +nlemma decidable_ar8_aux8 : +∀T.∀x1,x2,x3,x4,x5,x6,x7,x8,y1,y2,y3,y4,y5,y6,y7,y8:T. + (x8 ≠ y8) → + (mk_Array8T T x1 x2 x3 x4 x5 x6 x7 x8) ≠ (mk_Array8T T y1 y2 y3 y4 y5 y6 y7 y8). + #T; #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nnormalize; #H; #H1; + napply (H (ar8_destruct_8 … H1)). +nqed. + +nlemma decidable_ar8 : +∀T.(∀x,y:T.decidable (x = y)) → + (∀a1,a2:Array8T T.decidable (a1 = a2)). + #T; #H; + #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 (? = ?) (? ≠ ?) ? (H x1 y1) …); + ##[ ##2: #H1; napply (or2_intro2 … (decidable_ar8_aux1 T … H1)) + ##| ##1: #H1; napply (or2_elim (? = ?) (? ≠ ?) ? (H x2 y2) …); + ##[ ##2: #H2; napply (or2_intro2 … (decidable_ar8_aux2 T … H2)) + ##| ##1: #H2; napply (or2_elim (? = ?) (? ≠ ?) ? (H x3 y3) …); + ##[ ##2: #H3; napply (or2_intro2 … (decidable_ar8_aux3 T … H3)) + ##| ##1: #H3; napply (or2_elim (? = ?) (? ≠ ?) ? (H x4 y4) …); + ##[ ##2: #H4; napply (or2_intro2 … (decidable_ar8_aux4 T … H4)) + ##| ##1: #H4; napply (or2_elim (? = ?) (? ≠ ?) ? (H x5 y5) …); + ##[ ##2: #H5; napply (or2_intro2 … (decidable_ar8_aux5 T … H5)) + ##| ##1: #H5; napply (or2_elim (? = ?) (? ≠ ?) ? (H x6 y6) …); + ##[ ##2: #H6; napply (or2_intro2 … (decidable_ar8_aux6 T … H6)) + ##| ##1: #H6; napply (or2_elim (? = ?) (? ≠ ?) ? (H x7 y7) …); + ##[ ##2: #H7; napply (or2_intro2 … (decidable_ar8_aux7 T … H7)) + ##| ##1: #H7; napply (or2_elim (? = ?) (? ≠ ?) ? (H x8 y8) …); + ##[ ##2: #H8; napply (or2_intro2 … (decidable_ar8_aux8 T … H8)) + ##| ##1: #H8; nrewrite > H1; nrewrite > H2; nrewrite > H3; nrewrite > H4; + nrewrite > H5; nrewrite > H6; nrewrite > H7; nrewrite > H8; + napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …)) + ##] + ##] + ##] + ##] + ##] + ##] + ##] + ##] +nqed. + +(* !!! per brevita *) +naxiom neqar8_to_neq : +∀T.∀f:T → T → bool. + (∀x,y:T.f x y = false → x ≠ y) → + (∀p1,p2:Array8T T.(eq_ar8 T f p1 p2 = false → p1 ≠ p2)). + +(* !!! per brevita *) +naxiom neq_to_neqar8 : +∀T.∀f:T → T → bool. + (∀x,y:T.decidable (x = y)) → + (∀x,y:T.x ≠ y → f x y = false) → + (∀p1,p2:Array8T T.(p1 ≠ p2 → eq_ar8 T f p1 p2 = false)). + +nlemma ar8_is_comparable : comparable → comparable. + #T; @ (Array8T T) + ##[ napply (mk_Array8T ? (zeroc T) (zeroc T) (zeroc T) (zeroc T) + (zeroc T) (zeroc T) (zeroc T) (zeroc T)) + ##| napply (λP.(forallc T) + (λe1.(forallc T) + (λe2.(forallc T) + (λe3.(forallc T) + (λe4.(forallc T) + (λe5.(forallc T) + (λe6.(forallc T) + (λe7.(forallc T) + (λe8.P (mk_Array8T T e1 e2 e3 e4 e5 e6 e7 e8)))))))))) + ##| napply (eq_ar8 … (eqc T)) + ##| napply eqar8_to_eq; + napply (eqc_to_eq T) + ##| napply eq_to_eqar8; + napply (eq_to_eqc T) + ##| napply neqar8_to_neq; + napply (neqc_to_neq T) + ##| napply neq_to_neqar8; + ##[ napply (decidable_c T) + ##| napply (neq_to_neqc T) ##] + ##| napply decidable_ar8; + napply (decidable_c T) + ##| napply symmetric_eqar8; + napply (symmetric_eqc T) + ##] +nqed. + +unification hint 0 ≔ S: comparable ; + T ≟ (carr S), + X ≟ (ar8_is_comparable S) + (*********************************************) ⊢ + carr X ≡ Array8T T. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct_base.ma new file mode 100755 index 000000000..09ef946a0 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_struct_base.ma @@ -0,0 +1,191 @@ +(**************************************************************************) +(* ___ *) +(* ||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". + +(* **************** *) +(* 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 }. + +(* operatore uguaglianza *) +ndefinition eq_ar16 ≝ +λT.λf:T → T → bool.λa1,a2:Array16T T. + (f (a16_1 ? a1) (a16_1 ? a2)) ⊗ (f (a16_2 ? a1) (a16_2 ? a2)) ⊗ + (f (a16_3 ? a1) (a16_3 ? a2)) ⊗ (f (a16_4 ? a1) (a16_4 ? a2)) ⊗ + (f (a16_5 ? a1) (a16_5 ? a2)) ⊗ (f (a16_6 ? a1) (a16_6 ? a2)) ⊗ + (f (a16_7 ? a1) (a16_7 ? a2)) ⊗ (f (a16_8 ? a1) (a16_8 ? a2)) ⊗ + (f (a16_9 ? a1) (a16_9 ? a2)) ⊗ (f (a16_10 ? a1) (a16_10 ? a2)) ⊗ + (f (a16_11 ? a1) (a16_11 ? a2)) ⊗ (f (a16_12 ? a1) (a16_12 ? a2)) ⊗ + (f (a16_13 ? a1) (a16_13 ? a2)) ⊗ (f (a16_14 ? a1) (a16_14 ? a2)) ⊗ + (f (a16_15 ? a1) (a16_15 ? a2)) ⊗ (f (a16_16 ? a1) (a16_16 ? a2)). + +(* 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 + ]. + +(* ************************** *) +(* 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 }. + +(* operatore uguaglianza *) +ndefinition eq_ar8 ≝ +λT.λf:T → T → bool.λa1,a2:Array8T T. + (f (a8_1 ? a1) (a8_1 ? a2)) ⊗ (f (a8_2 ? a1) (a8_2 ? a2)) ⊗ + (f (a8_3 ? a1) (a8_3 ? a2)) ⊗ (f (a8_4 ? a1) (a8_4 ? a2)) ⊗ + (f (a8_5 ? a1) (a8_5 ? a2)) ⊗ (f (a8_6 ? a1) (a8_6 ? a2)) ⊗ + (f (a8_7 ? a1) (a8_7 ? a2)) ⊗ (f (a8_8 ? a1) (a8_8 ? a2)). + +(* 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 v e01 e02 e03 e04 e05 e06 e07 + | o1 ⇒ mk_Array8T T e00 v e02 e03 e04 e05 e06 e07 + | o2 ⇒ mk_Array8T T e00 e01 v e03 e04 e05 e06 e07 + | o3 ⇒ mk_Array8T T e00 e01 e02 v e04 e05 e06 e07 + | o4 ⇒ mk_Array8T T e00 e01 e02 e03 v e05 e06 e07 + | o5 ⇒ mk_Array8T T e00 e01 e02 e03 e04 v e06 e07 + | o6 ⇒ mk_Array8T T e00 e01 e02 e03 e04 e05 v e07 + | o7 ⇒ mk_Array8T T e00 e01 e02 e03 e04 e05 e06 v + ]. + +(* lettura byte *) +ndefinition byte8_of_bits ≝ +λp:Array8T bool. + mk_byte8 + (orc ? (match a8_1 ? p with [ true ⇒ x8 | false ⇒ x0 ]) + (orc ? (match a8_2 ? p with [ true ⇒ x4 | false ⇒ x0 ]) + (orc ? (match a8_3 ? p with [ true ⇒ x2 | false ⇒ x0 ]) + (match a8_4 ? p with [ true ⇒ x1 | false ⇒ x0 ])))) + (orc ? (match a8_5 ? p with [ true ⇒ x8 | false ⇒ x0 ]) + (orc ? (match a8_6 ? p with [ true ⇒ x4 | false ⇒ x0 ]) + (orc ? (match a8_7 ? p with [ true ⇒ x2 | false ⇒ x0 ]) + (match a8_8 ? p with [ true ⇒ x1 | false ⇒ x0 ])))). + +(* scrittura byte *) +ndefinition bits_of_exadecim ≝ +λe:exadecim.match e with + [ x0 ⇒ quadruple … false false false false + | x1 ⇒ quadruple … false false false true + | x2 ⇒ quadruple … false false true false + | x3 ⇒ quadruple … false false true true + | x4 ⇒ quadruple … false true false false + | x5 ⇒ quadruple … false true false true + | x6 ⇒ quadruple … false true true false + | x7 ⇒ quadruple … false true true true + | x8 ⇒ quadruple … true false false false + | x9 ⇒ quadruple … true false false true + | xA ⇒ quadruple … true false true false + | xB ⇒ quadruple … true false true true + | xC ⇒ quadruple … true true false false + | xD ⇒ quadruple … true true false true + | xE ⇒ quadruple … true true true false + | xF ⇒ quadruple … true true true true + ]. + +ndefinition bits_of_byte8 ≝ +λb:byte8. + mk_Array8T ? (fst4T … (bits_of_exadecim (cnH ? b))) + (snd4T … (bits_of_exadecim (cnH ? b))) + (thd4T … (bits_of_exadecim (cnH ? b))) + (fth4T … (bits_of_exadecim (cnH ? b))) + (fst4T … (bits_of_exadecim (cnL ? b))) + (snd4T … (bits_of_exadecim (cnL ? b))) + (thd4T … (bits_of_exadecim (cnL ? b))) + (fth4T … (bits_of_exadecim (cnL ? b))). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_trees.ma b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_trees.ma new file mode 100755 index 000000000..c1fc2b8d0 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/memory/memory_trees.ma @@ -0,0 +1,128 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_base.ma". +include "emulator/memory/memory_struct.ma". +include "num/word32.ma". +include "common/list.ma". + +(* ************************** *) +(* 8 segmenti da 64Kb → 512Kb *) +(* 4 + 16 bit indirizzo *) +(* ************************** *) + +(* ********************* *) +(* MEMORIA E DESCRITTORE *) +(* ********************* *) + +ndefinition aux_20B_filler ≝ +λT:Type.λel:T. +let lev4 ≝ mk_Array16T T el el el el el el el el el el el el el el el el 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 +let lev0 ≝ mk_Array8T ? + lev1 lev1 lev1 lev1 lev1 lev1 lev1 lev1 + in +lev0. + +ndefinition aux_20B_type ≝ +λT:Type.Array8T (Array16T (Array16T (Array16T (Array16T T)))). + +(* tutta la memoria non installata *) +ndefinition mt_out_of_bound_memory ≝ aux_20B_filler ? MEM_OUT_OF_BOUND. + +(* tutta la memoria a 0 *) +ndefinition mt_zero_memory ≝ aux_20B_filler ? 〈x0,x0〉. + +(* visita di un albero da 512Kb di elementi: ln16(512Kb)=5 passaggi *) +ndefinition mt_visit ≝ +λT:Type.λdata:aux_20B_type T.λsel:oct.λaddr:word16. + getn_array16T (cnL ? (cnL ? addr)) ? + (getn_array16T (cnH ? (cnL ? addr)) ? + (getn_array16T (cnL ? (cnH ? addr)) ? + (getn_array16T (cnH ? (cnH ? addr)) ? + (getn_array8T sel ? data)))). + +(* scrittura di un elemento in un albero da 512Kb *) +ndefinition mt_update ≝ +λT:Type.λdata:aux_20B_type T.λsel:oct.λaddr:word16.λv:T. + let lev1 ≝ getn_array8T sel ? data in + let lev2 ≝ getn_array16T (cnH ? (cnH ? addr)) ? lev1 in + let lev3 ≝ getn_array16T (cnL ? (cnH ? addr)) ? lev2 in + let lev4 ≝ getn_array16T (cnH ? (cnL ? addr)) ? lev3 in + setn_array8T sel ? data + (setn_array16T (cnH ? (cnH ? addr)) ? lev1 + (setn_array16T (cnL ? (cnH ? addr)) ? lev2 + (setn_array16T (cnH ? (cnL ? addr)) ? lev3 + (setn_array16T (cnL ? (cnL ? addr)) T lev4 v)))). + +(* scrittura di un segmento (max 64Kb) degli otto disponibili *) +nlet rec mt_update_ranged (T:Type) (data:aux_20B_type T) (sel:oct) (addr:word16) (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 sel addr v) + sel (succc ? addr) w' rw' v + ]. + +(* scrivi controllando il tipo di memoria *) +ndefinition mt_mem_update ≝ +λmem:aux_20B_type byte8. +λchk:aux_20B_type memory_type. +λsel:oct.λaddr:word16.λv:byte8. + match mt_visit ? chk sel addr with + (* ROM? ok, ma il valore viene perso *) + [ MEM_READ_ONLY ⇒ Some ? mem + (* RAM? ok *) + | MEM_READ_WRITE ⇒ Some ? (mt_update ? mem sel addr v) + (* NON INSTALLATA? no *) + | MEM_OUT_OF_BOUND ⇒ None ? ]. + +(* leggi controllando il tipo di memoria *) +ndefinition mt_mem_read ≝ +λmem:aux_20B_type byte8. +λchk:aux_20B_type memory_type. +λsel:oct.λaddr:word16. + match mt_visit ? chk sel addr with + [ MEM_READ_ONLY ⇒ Some ? (mt_visit ? mem sel addr) + | MEM_READ_WRITE ⇒ Some ? (mt_visit ? mem sel 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_20B_type byte8) + (src:list byte8) (sel:oct) (addr:word16) 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 sel addr hd) + tl sel (succc ? addr) + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table_tests.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table_tests.ma new file mode 100755 index 000000000..4db6013b7 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC05_table_tests.ma @@ -0,0 +1,94 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/opcodes/pseudo.ma". +include "emulator/opcodes/HC05_table.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〉 + ]. + +nlemma ok_byte_table_HC05 : forallc ? (λb. + (test_not_impl_byte b HC05_not_impl_byte ⊙ eqc ? (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) ⊙ eqc ? (get_byte_count HC05 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC05: pseudocodici non implementati come da manuale *) +ndefinition HC05_not_impl_pseudo ≝ + [ AIS ; AIX ; BGE ; BGND ; BGT ; BLE ; BLT ; CBEQA ; CBEQX ; CPHX ; DAA + ; DBNZ ; DIV ; LDHX ; MOV ; NSA ; PSHA ; PSHH ; PSHX ; PULA ; PULH ; PULX + ; SHA ; SLA ; STHX ; TAP ; TPA ; TSX ; TXS ]. + +nlemma ok_pseudo_table_HC05 : forallc ? (λo. + (test_not_impl_pseudo HC05 o HC05_not_impl_pseudo ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC05 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) ⊗ + (⊖ (test_not_impl_pseudo HC05 o HC05_not_impl_pseudo) ⊙ eqc ? (get_pseudo_count HC05 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC05: modalita' non implementate come da manuale *) +ndefinition HC05_not_impl_mode ≝ + [ MODE_INHH ; MODE_SP1 ; MODE_SP2 ; MODE_DIR1_to_DIR1 + ; MODE_IMM1_to_DIR1 ; MODE_IX0p_to_DIR1 ; MODE_DIR1_to_IX0p + ; MODE_INHA_and_IMM1 ; MODE_INHX_and_IMM1 ; MODE_IMM1_and_IMM1 + ; MODE_DIR1_and_IMM1 ; MODE_IX0_and_IMM1 ; MODE_IX0p_and_IMM1 + ; MODE_IX1_and_IMM1 ; MODE_IX1p_and_IMM1 ; MODE_SP1_and_IMM1 + ; MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HC05 : forallc ? (λi. + (test_not_impl_mode HC05 i HC05_not_impl_mode ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC05 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05)) ⊗ + (⊖ (test_not_impl_mode HC05 i HC05_not_impl_mode) ⊙ eqc ? (get_mode_count HC05 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC05) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_PsIm_table_HC05 : + forallc ? (λi. + forallc ? (λps. + lec ? (get_PsIm_count HC05 ps 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_assembly2/emulator/opcodes/HC08_table_tests.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table_tests.ma new file mode 100755 index 000000000..8fef52ea2 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HC08_table_tests.ma @@ -0,0 +1,123 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/opcodes/pseudo.ma". +include "emulator/opcodes/HC08_table.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〉 + ]. + +nlemma ok_byte_table_HC08 : forallc ? (λb. + (test_not_impl_byte b HC08_not_impl_byte ⊙ eqc ? (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) ⊙ eqc ? (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〉 + ]. + +nlemma ok_word_table_HC08 : forallc ? (λb. + (test_not_impl_byte b HC08_not_impl_word ⊙ eqc ? (get_word_count HC08 〈〈x9,xE〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HC08_not_impl_word) ⊙ eqc ? (get_word_count HC08 〈〈x9,xE〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC08: pseudocodici non implementati come da manuale *) +ndefinition HC08_not_impl_pseudo ≝ + [ BGND ; SHA ; SLA ]. + +nlemma ok_pseudo_table_HC08 : forallc ? (λo. + (test_not_impl_pseudo HC08 o HC08_not_impl_pseudo ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HC08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) ⊗ + (⊖ (test_not_impl_pseudo HC08 o HC08_not_impl_pseudo) ⊙ eqc ? (get_pseudo_count HC08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HC08: modalita' non implementate come da manuale *) +ndefinition HC08_not_impl_mode ≝ + [ MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HC08 : forallc ? (λi. + (test_not_impl_mode HC08 i HC08_not_impl_mode ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HC08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08)) ⊗ + (⊖ (test_not_impl_mode HC08 i HC08_not_impl_mode) ⊙ eqc ? (get_mode_count HC08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HC08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_PsIm_table_HC08 : + forallc ? (λi. + forallc ? (λps. + lec ? (get_PsIm_count HC08 ps 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_assembly2/emulator/opcodes/HCS08_table_tests.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table_tests.ma new file mode 100755 index 000000000..64a45ac01 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/HCS08_table_tests.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/opcodes/pseudo.ma". +include "emulator/opcodes/HCS08_table.ma". + +(* ****************** *) +(* TABELLA DELL'HCS08 *) +(* ****************** *) + +(* HCS08: opcode non implementati come da manuale (byte) *) +ndefinition HCS08_not_impl_byte ≝ + [〈x8,xD〉 + ;〈x9,xE〉 + ;〈xA,xC〉 + ]. + +nlemma ok_byte_table_HCS08 : forallc ? (λb. + (test_not_impl_byte b HCS08_not_impl_byte ⊙ eqc ? (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) ⊙ eqc ? (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〉 + ]. + +nlemma ok_word_table_HCS08 : forallc ? (λb. + (test_not_impl_byte b HCS08_not_impl_word ⊙ eqc ? (get_word_count HCS08 〈〈x9,xE〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b HCS08_not_impl_word) ⊙ eqc ? (get_word_count HCS08 〈〈x9,xE〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HCS08: pseudocodici non implementati come da manuale *) +ndefinition HCS08_not_impl_pseudo ≝ + [ SHA ; SLA ]. + +nlemma ok_pseudo_table_HCS08 : forallc ? (λo. + (test_not_impl_pseudo HCS08 o HCS08_not_impl_pseudo ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count HCS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) ⊗ + (⊖ (test_not_impl_pseudo HCS08 o HCS08_not_impl_pseudo) ⊙ eqc ? (get_pseudo_count HCS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* HCS08: modalita' non implementate come da manuale *) +ndefinition HCS08_not_impl_mode ≝ + [ MODE_TNY x0 ; MODE_TNY x1 ; MODE_TNY x2 ; MODE_TNY x3 + ; MODE_TNY x4 ; MODE_TNY x5 ; MODE_TNY x6 ; MODE_TNY x7 + ; MODE_TNY x8 ; MODE_TNY x9 ; MODE_TNY xA ; MODE_TNY xB + ; MODE_TNY xC ; MODE_TNY xD ; MODE_TNY xE ; MODE_TNY xF + ; MODE_SRT t00 ; MODE_SRT t01 ; MODE_SRT t02 ; MODE_SRT t03 + ; MODE_SRT t04 ; MODE_SRT t05 ; MODE_SRT t06 ; MODE_SRT t07 + ; MODE_SRT t08 ; MODE_SRT t09 ; MODE_SRT t0A ; MODE_SRT t0B + ; MODE_SRT t0C ; MODE_SRT t0D ; MODE_SRT t0E ; MODE_SRT t0F + ; MODE_SRT t10 ; MODE_SRT t11 ; MODE_SRT t12 ; MODE_SRT t13 + ; MODE_SRT t14 ; MODE_SRT t15 ; MODE_SRT t16 ; MODE_SRT t17 + ; MODE_SRT t18 ; MODE_SRT t19 ; MODE_SRT t1A ; MODE_SRT t1B + ; MODE_SRT t1C ; MODE_SRT t1D ; MODE_SRT t1E ; MODE_SRT t1F ]. + +nlemma ok_mode_table_HCS08 : forallc ? (λi. + (test_not_impl_mode HCS08 i HCS08_not_impl_mode ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count HCS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08)) ⊗ + (⊖ (test_not_impl_mode HCS08 i HCS08_not_impl_mode) ⊙ eqc ? (get_mode_count HCS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_HCS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_PsIm_table_HCS08 : + forallc ? (λi. + forallc ? (λps. + lec ? (get_PsIm_count HCS08 ps 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_assembly2/emulator/opcodes/IP2022_instr_mode.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_instr_mode.ma index 0029847d3..68968a1a9 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_instr_mode.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_instr_mode.ma @@ -67,3 +67,19 @@ nlemma symmetric_eqIP2022im : symmetricT IP2022_instr_mode bool eq_IP2022_im. napply (neq_to_neqIP2022im n2 n1 (symmetric_neq ? n1 n2 H)) ##] nqed. + +nlemma IP2022im_is_comparable : comparable. + @ IP2022_instr_mode + ##[ napply MODE_INH + ##| napply forall_IP2022_im + ##| napply eq_IP2022_im + ##| napply eqIP2022im_to_eq + ##| napply eq_to_eqIP2022im + ##| napply neqIP2022im_to_neq + ##| napply neq_to_neqIP2022im + ##| napply decidable_IP2022im + ##| napply symmetric_eqIP2022im + ##] +nqed. + +unification hint 0 ≔ ⊢ carr IP2022im_is_comparable ≡ IP2022_instr_mode. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table_tests.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table_tests.ma new file mode 100755 index 000000000..103c29461 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/IP2022_table_tests.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/opcodes/pseudo.ma". +include "emulator/opcodes/IP2022_table.ma". + +(* ******************* *) +(* TABELLA DELL'IP2022 *) +(* ******************* *) + +(* IP2022: opcode non implementati come da manuale (byte) *) +ndefinition IP2022_not_impl_byte ≝ + [〈x0,x0〉;〈x5,x2〉;〈x5,x3〉;〈x5,x6〉;〈x5,x7〉;〈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,x5〉 ]. + +(*nlemma ok_byte_table_IP2022 : forallc ? (λb. + (test_not_impl_byte b IP2022_not_impl_byte ⊙ eqc ? (get_byte_count IP2022 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b IP2022_not_impl_byte) ⊙ eqc ? (get_byte_count IP2022 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed.*) + +(* IP2022: opcode non implementati come da manuale (0x00+byte) *) +ndefinition IP2022_not_impl_word ≝ + [〈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〉 + ]. + +nlemma ok_word_table_IP2022 : forallc ? (λb. + (test_not_impl_byte b IP2022_not_impl_word ⊙ eqc ? (get_word_count IP2022 〈〈x0,x0〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022) 〈〈x0,x0〉:〈x0,x1〉〉) ⊗ + (⊖ (test_not_impl_byte b IP2022_not_impl_word) ⊙ eqc ? (get_word_count IP2022 〈〈x0,x0〉:b〉 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* tutti gli pseudo implementati *) +nlemma ok_pseudo_table_IP2022 : + forallc ? (λo. + lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count IP2022 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022)) = true. + napply refl_eq. +nqed. + +(* tutte le modalita' implementate *) +nlemma ok_mode_table_IP2022 : + forallc ? (λi. + lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count IP2022 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022)) = true. + napply refl_eq. +nqed. + +nlemma ok_PsIm_table_IP2022 : + forallc ? (λi. + forallc ? (λps. + lec ? (get_PsIm_count IP2022 ps i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_IP2022) 〈〈x0,x0〉:〈x0,x1〉〉)) = true. + napply refl_eq. +nqed. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table_tests.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table_tests.ma new file mode 100755 index 000000000..2d83ad6d4 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/RS08_table_tests.ma @@ -0,0 +1,78 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/opcodes/pseudo.ma". +include "emulator/opcodes/RS08_table.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〉 + ]. + +nlemma ok_byte_table_RS08 : forallc ? (λb. + (test_not_impl_byte b RS08_not_impl_byte ⊙ eqc ? (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) ⊙ eqc ? (get_byte_count RS08 b 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* RS08: pseudocodici non implementati come da manuale *) +ndefinition RS08_not_impl_pseudo ≝ + [ AIS ; AIX ; ASR ; BGE ; BGT ; BHCC ; BHCS ; BHI ; BIH ; BIL ; BIT ; BLE ; BLS + ; BLT ; BMC ; BMI ; BMS ; BPL ; BRN ; CBEQX ; CLI ; CPHX ; CPX ; DAA ; DIV + ; LDHX ; LDX ; MUL ; NEG ; NSA ; PSHA ; PSHH ; PSHX ; PULA ; PULH ; PULX ; RSP + ; RTI ; SEI ; STHX ; STX ; SWI ; TAP ; TAX ; TPA ; TST ; TSX ; TXA ; TXS ]. + +nlemma ok_pseudo_table_RS08 : forallc ? (λo. + (test_not_impl_pseudo RS08 o RS08_not_impl_pseudo ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_pseudo_count RS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) ⊗ + (⊖ (test_not_impl_pseudo RS08 o RS08_not_impl_pseudo) ⊙ eqc ? (get_pseudo_count RS08 o 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +(* RS08: modalita' non implementate come da manuale *) +ndefinition RS08_not_impl_mode ≝ + [ MODE_INHX ; MODE_INHH ; MODE_INHX0ADD ; MODE_INHX1ADD ; MODE_INHX2ADD ; MODE_IMM1EXT + ; MODE_DIR2 ; MODE_IX0 ; MODE_IX1 ; MODE_IX2 ; MODE_SP1 ; MODE_SP2 + ; MODE_IX0p_to_DIR1 ; MODE_DIR1_to_IX0p ; MODE_INHX_and_IMM1 ; MODE_IX0_and_IMM1 + ; MODE_IX0p_and_IMM1 ; MODE_IX1_and_IMM1 ; MODE_IX1p_and_IMM1 ; MODE_SP1_and_IMM1 ]. + +nlemma ok_mode_table_RS08 : forallc ? (λi. + (test_not_impl_mode RS08 i RS08_not_impl_mode ⊙ lec ? 〈〈x0,x0〉:〈x0,x1〉〉 (get_mode_count RS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08)) ⊗ + (⊖ (test_not_impl_mode RS08 i RS08_not_impl_mode) ⊙ eqc ? (get_mode_count RS08 i 〈〈x0,x0〉:〈x0,x0〉〉 opcode_table_RS08) 〈〈x0,x0〉:〈x0,x0〉〉)) + = true. + napply refl_eq. +nqed. + +nlemma ok_PsIm_table_RS08 : + forallc ? (λi. + forallc ? (λps. + lec ? (get_PsIm_count RS08 ps 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_assembly2/emulator/opcodes/pseudo.ma b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma index b86e307f2..c881965ac 100755 --- a/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma +++ b/helm/software/matita/contribs/ng_assembly2/emulator/opcodes/pseudo.ma @@ -58,6 +58,40 @@ ndefinition aux_pseudo_type ≝ | IP2022 ⇒ IP2022_pseudo ]. +ndefinition pseudo_is_comparable: mcu_type → comparable. + #mcu; @ (aux_pseudo_type mcu) + ##[ nelim mcu; + ##[ ##1,2,3,4: napply (zeroc Freescalepseudo_is_comparable) + ##| ##5: napply (zeroc IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (forallc Freescalepseudo_is_comparable) + ##| ##5: napply (forallc IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eqc Freescalepseudo_is_comparable) + ##| ##5: napply (eqc IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eqc_to_eq Freescalepseudo_is_comparable) + ##| ##5: napply (eqc_to_eq IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eq_to_eqc Freescalepseudo_is_comparable) + ##| ##5: napply (eq_to_eqc IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (neqc_to_neq Freescalepseudo_is_comparable) + ##| ##5: napply (neqc_to_neq IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (neq_to_neqc Freescalepseudo_is_comparable) + ##| ##5: napply (neq_to_neqc IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (decidable_c Freescalepseudo_is_comparable) + ##| ##5: napply (decidable_c IP2022pseudo_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (symmetric_eqc Freescalepseudo_is_comparable) + ##| ##5: napply (symmetric_eqc IP2022pseudo_is_comparable) ##] + ##] +nqed. + +unification hint 0 ≔ M:mcu_type ⊢ carr (pseudo_is_comparable M) ≡ aux_pseudo_type M. + ndefinition aux_im_type ≝ λmcu:mcu_type.match mcu with [ HC05 ⇒ Freescale_instr_mode @@ -67,47 +101,71 @@ ndefinition aux_im_type ≝ | IP2022 ⇒ IP2022_instr_mode ]. +ndefinition im_is_comparable: mcu_type → comparable. + #mcu; @ (aux_im_type mcu) + ##[ nelim mcu; + ##[ ##1,2,3,4: napply (zeroc Freescaleim_is_comparable) + ##| ##5: napply (zeroc IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (forallc Freescaleim_is_comparable) + ##| ##5: napply (forallc IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eqc Freescaleim_is_comparable) + ##| ##5: napply (eqc IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eqc_to_eq Freescaleim_is_comparable) + ##| ##5: napply (eqc_to_eq IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (eq_to_eqc Freescaleim_is_comparable) + ##| ##5: napply (eq_to_eqc IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (neqc_to_neq Freescaleim_is_comparable) + ##| ##5: napply (neqc_to_neq IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (neq_to_neqc Freescaleim_is_comparable) + ##| ##5: napply (neq_to_neqc IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (decidable_c Freescaleim_is_comparable) + ##| ##5: napply (decidable_c IP2022im_is_comparable) ##] + ##| nelim mcu; + ##[ ##1,2,3,4: napply (symmetric_eqc Freescaleim_is_comparable) + ##| ##5: napply (symmetric_eqc IP2022im_is_comparable) ##] + ##] +nqed. + +unification hint 0 ≔ M:mcu_type ⊢ carr (im_is_comparable M) ≡ aux_im_type M. + (* ********************************************* *) (* STRUMENTI PER LE DIMOSTRAZIONI DI CORRETTEZZA *) (* ********************************************* *) ndefinition aux_table_type ≝ λmcu:mcu_type.Prod4T (aux_pseudo_type mcu) (aux_im_type mcu) byte8_or_word16 byte8. -naxiom daemon: False. - -ndefinition pseudo_is_comparable: mcu_type → comparable. - #mcu; - @ (aux_pseudo_type mcu) - ##[ napply (match mcu return λmcu. aux_pseudo_type mcu with - [ HC05 ⇒ zeroc Freescalepseudo_is_comparable - | HC08 ⇒ zeroc Freescalepseudo_is_comparable - | HCS08 ⇒ zeroc Freescalepseudo_is_comparable - | RS08 ⇒ zeroc Freescalepseudo_is_comparable - | IP2022 ⇒ zeroc IP2022pseudo_is_comparable - ]) - | napply (match mcu return λmcu. (aux_pseudo_type mcu → bool) → bool with - [ HC05 ⇒ forallc Freescalepseudo_is_comparable - | HC08 ⇒ forallc Freescalepseudo_is_comparable - | HCS08 ⇒ forallc Freescalepseudo_is_comparable - | RS08 ⇒ forallc Freescalepseudo_is_comparable - | IP2022 ⇒ forallc IP2022pseudo_is_comparable - ]) - | napply (match mcu return λmcu. aux_pseudo_type mcu → aux_pseudo_type mcu → bool with - [ HC05 ⇒ eqc Freescalepseudo_is_comparable - | HC08 ⇒ eqc Freescalepseudo_is_comparable - | HCS08 ⇒ eqc Freescalepseudo_is_comparable - | RS08 ⇒ eqc Freescalepseudo_is_comparable - | IP2022 ⇒ eqc IP2022pseudo_is_comparable - ]) - |##*: ncases daemon ] -nqed. - - -(* come suggerire di unificare? - carr (pseudo_is_comparable M) = aux_pseudo_type M *) +(* 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 eqc ? b b' with + [ true ⇒ get_byte_count m b (succc ? c) tl + | false ⇒ get_byte_count m b c tl + ] + | Word _ ⇒ get_byte_count m b c tl + ] + ]. -unification hint 0 ≔ MCU:mcu_type ⊢ - carr (pseudo_is_comparable MCU) ≡ aux_pseudo_type MCU. +(* su tutta la lista quante volte compare la word *) +nlet rec get_word_count (m:mcu_type) (w:word16) (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 w c tl + | Word w' ⇒ match eqc ? w w' with + [ true ⇒ get_word_count m w (succc ? c) tl + | false ⇒ get_word_count m w c tl + ] + ] + ]. (* su tutta la lista quante volte compare lo pseudocodice *) nlet rec get_pseudo_count (m:mcu_type) (o:aux_pseudo_type m) (c:word16) (l:list (aux_table_type m)) on l ≝ @@ -118,3 +176,55 @@ nlet rec get_pseudo_count (m:mcu_type) (o:aux_pseudo_type m) (c:word16) (l:list | 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 eqc ? i (snd4T … hd) with + [ true ⇒ get_mode_count m i (succc ? 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 eqc ? b hd with + [ true ⇒ true + | false ⇒ test_not_impl_byte b tl + ] + ]. + +(* su tutta la lista quante volte compare la coppia pseudo,instr_mode *) +nlet rec get_PsIm_count (m:mcu_type) (o:aux_pseudo_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 (eqc ? o (fst4T … hd)) ⊗ + (eqc ? i (snd4T … hd)) with + [ true ⇒ get_PsIm_count m o i (succc ? c) tl + | false ⇒ get_PsIm_count m o i c tl + ] + ]. + +(* o e' non implementato? *) +nlet rec test_not_impl_pseudo (m:mcu_type) (o:aux_pseudo_type m) (l:list (aux_pseudo_type m)) on l ≝ + match l with + [ nil ⇒ false + | cons hd tl ⇒ match eqc ? 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 eqc ? i hd with + [ true ⇒ true + | false ⇒ test_not_impl_mode m i tl + ] + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status.ma new file mode 100755 index 000000000..405f92e52 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status.ma @@ -0,0 +1,352 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/status/HC05_status_base.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 eq_to_eqaluHC05 : ∀alu1,alu2.alu1 = alu2 → eq_HC05_alu 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 ( + ((eqc ? y1 y1) ⊗ (eqc ? y2 y2) ⊗ + (eqc ? y3 y3) ⊗ (eqc ? y4 y4) ⊗ + (eqc ? y5 y5) ⊗ (eqc ? y6 y6) ⊗ + (eqc ? y7 y7) ⊗ (eqc ? y8 y8) ⊗ + (eqc ? y9 y9) ⊗ (eqc ? y10 y10) ⊗ + (eqc ? y11 y11) ⊗ (eqc ? y12 y12) ⊗ + (eqc ? y13 y13)) = true); + nrewrite > (eq_to_eqc ? y1 y1 (refl_eq …)); + nrewrite > (eq_to_eqc ? y2 y2 (refl_eq …)); + nrewrite > (eq_to_eqc ? y3 y3 (refl_eq …)); + nrewrite > (eq_to_eqc ? y4 y4 (refl_eq …)); + nrewrite > (eq_to_eqc ? y5 y5 (refl_eq …)); + nrewrite > (eq_to_eqc ? y6 y6 (refl_eq …)); + nrewrite > (eq_to_eqc ? y7 y7 (refl_eq …)); + nrewrite > (eq_to_eqc ? y8 y8 (refl_eq …)); + nrewrite > (eq_to_eqc ? y9 y9 (refl_eq …)); + nrewrite > (eq_to_eqc ? y10 y10 (refl_eq …)); + nrewrite > (eq_to_eqc ? y11 y11 (refl_eq …)); + nrewrite > (eq_to_eqc ? y12 y12 (refl_eq …)); + nrewrite > (eq_to_eqc ? y13 y13 (refl_eq …)); + napply refl_eq. +nqed. + +nlemma neqaluHC05_to_neq : ∀alu1,alu2.eq_HC05_alu alu1 alu2 = false → alu1 ≠ alu2. + #s1; #s2; #H; + napply (not_to_not (s1 = s2) (eq_HC05_alu s1 s2 = true) …); + ##[ ##1: napply (eq_to_eqaluHC05 s1 s2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqaluHC05_to_eq : ∀alu1,alu2.eq_HC05_alu 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 ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ + (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ + (eqc ? x7 y7) ⊗ (eqc ? x8 y8) ⊗ + (eqc ? x9 y9) ⊗ (eqc ? x10 y10) ⊗ + (eqc ? x11 y11) ⊗ (eqc ? x12 y12) ⊗ + (eqc ? x13 y13)) = true); + nrewrite > (eqc_to_eq … (andb_true_true_r … H)); + nletin H1 ≝ (andb_true_true_l … H); + nrewrite > (eqc_to_eq … (andb_true_true_r … (andb_true_true_l … H))); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (eqc_to_eq … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (eqc_to_eq … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (eqc_to_eq … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (eqc_to_eq … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (eqc_to_eq … (andb_true_true_r … H6)); + nletin H7 ≝ (andb_true_true_l … H6); + nrewrite > (eqc_to_eq … (andb_true_true_r … H7)); + nletin H8 ≝ (andb_true_true_l … H7); + nrewrite > (eqc_to_eq … (andb_true_true_r … H8)); + nletin H9 ≝ (andb_true_true_l … H8); + nrewrite > (eqc_to_eq … (andb_true_true_r … H9)); + nletin H10 ≝ (andb_true_true_l … H9); + nrewrite > (eqc_to_eq … (andb_true_true_r … H10)); + nletin H11 ≝ (andb_true_true_l … H10); + nrewrite > (eqc_to_eq … (andb_true_true_r … H11)); + nrewrite > (eqc_to_eq … (andb_true_true_l … H11)); + napply refl_eq. +nqed. + +nlemma neq_to_neqaluHC05 : ∀alu1,alu2.alu1 ≠ alu2 → eq_HC05_alu alu1 alu2 = false. + #s1; #s2; #H; + napply (neqtrue_to_eqfalse (eq_HC05_alu s1 s2)); + napply (not_to_not (eq_HC05_alu s1 s2 = true) (s1 = s2) ? H); + napply (eqaluHC05_to_eq s1 s2). +nqed. + +nlemma decidable_aluHC05 : ∀x,y:alu_HC05.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_HC05_alu x y = true) (eq_HC05_alu x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqaluHC05_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqaluHC05_to_neq … H)) + ##] +nqed. + +nlemma symmetric_eqaluHC05 : symmetricT alu_HC05 bool eq_HC05_alu. + #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 ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ (eqc ? x7 y7) ⊗ (eqc ? x8 y8) ⊗ + (eqc ? x9 y9) ⊗ (eqc ? x10 y10) ⊗ (eqc ? x11 y11) ⊗ (eqc ? x12 y12) ⊗ + (eqc ? x13 y13)) = ((eqc ? y1 x1) ⊗ (eqc ? y2 x2) ⊗ (eqc ? y3 x3) ⊗ + (eqc ? y4 x4) ⊗ (eqc ? y5 x5) ⊗ (eqc ? y6 x6) ⊗ (eqc ? y7 x7) ⊗ + (eqc ? y8 x8) ⊗ (eqc ? y9 x9) ⊗ (eqc ? y10 x10) ⊗ (eqc ? y11 x11) ⊗ + (eqc ? y12 x12) ⊗ (eqc ? y13 x13))); + nrewrite > (symmetric_eqc ? x1 y1); + nrewrite > (symmetric_eqc ? x2 y2); + nrewrite > (symmetric_eqc ? x3 y3); + nrewrite > (symmetric_eqc ? x4 y4); + nrewrite > (symmetric_eqc ? x5 y5); + nrewrite > (symmetric_eqc ? x6 y6); + nrewrite > (symmetric_eqc ? x7 y7); + nrewrite > (symmetric_eqc ? x8 y8); + nrewrite > (symmetric_eqc ? x9 y9); + nrewrite > (symmetric_eqc ? x10 y10); + nrewrite > (symmetric_eqc ? x11 y11); + nrewrite > (symmetric_eqc ? x12 y12); + nrewrite > (symmetric_eqc ? x13 y13); + napply refl_eq. +nqed. + +nlemma aluHC05_is_comparable : comparable. + @ alu_HC05 + ##[ napply (mk_alu_HC05 (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?)) + ##| napply forall_HC05_alu + ##| napply eq_HC05_alu + ##| napply eqaluHC05_to_eq + ##| napply eq_to_eqaluHC05 + ##| napply neqaluHC05_to_neq + ##| napply neq_to_neqaluHC05 + ##| napply decidable_aluHC05 + ##| napply symmetric_eqaluHC05 + ##] +nqed. + +unification hint 0 ≔ ⊢ carr aluHC05_is_comparable ≡ alu_HC05. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status_base.ma new file mode 100755 index 000000000..51105aff0 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC05_status_base.ma @@ -0,0 +1,283 @@ +(**************************************************************************) +(* ___ *) +(* ||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". + +(* *********************************** *) +(* 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). + +(* ****** *) +(* SETTER *) +(* ****** *) + +(* 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 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 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) + (orc ? (andc ? 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 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) + (andc ? 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 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 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 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 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 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 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'. + +(* ***************** *) +(* CONFRONTO FRA ALU *) +(* ***************** *) + +(* confronto registro per registro dell'HC05 *) +ndefinition eq_HC05_alu ≝ +λalu1,alu2:alu_HC05. + (eqc ? (acc_low_reg_HC05 alu1) (acc_low_reg_HC05 alu2)) ⊗ + (eqc ? (indX_low_reg_HC05 alu1) (indX_low_reg_HC05 alu2)) ⊗ + (eqc ? (sp_reg_HC05 alu1) (sp_reg_HC05 alu2)) ⊗ + (eqc ? (sp_mask_HC05 alu1) (sp_mask_HC05 alu2)) ⊗ + (eqc ? (sp_fix_HC05 alu1) (sp_fix_HC05 alu2)) ⊗ + (eqc ? (pc_reg_HC05 alu1) (pc_reg_HC05 alu2)) ⊗ + (eqc ? (pc_mask_HC05 alu1) (pc_mask_HC05 alu2)) ⊗ + (eqc ? (h_flag_HC05 alu1) (h_flag_HC05 alu2)) ⊗ + (eqc ? (i_flag_HC05 alu1) (i_flag_HC05 alu2)) ⊗ + (eqc ? (n_flag_HC05 alu1) (n_flag_HC05 alu2)) ⊗ + (eqc ? (z_flag_HC05 alu1) (z_flag_HC05 alu2)) ⊗ + (eqc ? (c_flag_HC05 alu1) (c_flag_HC05 alu2)) ⊗ + (eqc ? (irq_flag_HC05 alu1) (irq_flag_HC05 alu2)). + +ndefinition forall_HC05_alu ≝ λP:alu_HC05 → bool. + forallc ? (λr1.forallc ? (λr2. + forallc ? (λr3.forallc ? (λr4. + forallc ? (λr5.forallc ? (λr6. + forallc ? (λr7.forallc ? (λr8. + forallc ? (λr9.forallc ? (λr10. + forallc ? (λr11.forallc ? (λr12. + forallc ? (λr13.P (mk_alu_HC05 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13)))))))))))))). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status.ma new file mode 100755 index 000000000..85e60f127 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status.ma @@ -0,0 +1,324 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/status/HC08_status_base.ma". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +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 eq_to_eqaluHC08 : ∀alu1,alu2.alu1 = alu2 → eq_HC08_alu 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 ( + ((eqc ? y1 y1) ⊗ (eqc ? y2 y2) ⊗ (eqc ? y3 y3) ⊗ (eqc ? y4 y4) ⊗ + (eqc ? y5 y5) ⊗ (eqc ? y6 y6) ⊗ (eqc ? y7 y7) ⊗ (eqc ? y8 y8) ⊗ + (eqc ? y9 y9) ⊗ (eqc ? y10 y10) ⊗ (eqc ? y11 y11) ⊗ (eqc ? y12 y12)) = true); + nrewrite > (eq_to_eqc ? y1 y1 (refl_eq …)); + nrewrite > (eq_to_eqc ? y2 y2 (refl_eq …)); + nrewrite > (eq_to_eqc ? y3 y3 (refl_eq …)); + nrewrite > (eq_to_eqc ? y4 y4 (refl_eq …)); + nrewrite > (eq_to_eqc ? y5 y5 (refl_eq …)); + nrewrite > (eq_to_eqc ? y6 y6 (refl_eq …)); + nrewrite > (eq_to_eqc ? y7 y7 (refl_eq …)); + nrewrite > (eq_to_eqc ? y8 y8 (refl_eq …)); + nrewrite > (eq_to_eqc ? y9 y9 (refl_eq …)); + nrewrite > (eq_to_eqc ? y10 y10 (refl_eq …)); + nrewrite > (eq_to_eqc ? y11 y11 (refl_eq …)); + nrewrite > (eq_to_eqc ? y12 y12 (refl_eq …)); + napply refl_eq. +nqed. + +nlemma neqaluHC08_to_neq : ∀alu1,alu2.eq_HC08_alu alu1 alu2 = false → alu1 ≠ alu2. + #s1; #s2; #H; + napply (not_to_not (s1 = s2) (eq_HC08_alu s1 s2 = true) …); + ##[ ##1: napply (eq_to_eqaluHC08 s1 s2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqaluHC08_to_eq : ∀alu1,alu2.eq_HC08_alu 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 ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ (eqc ? x7 y7) ⊗ (eqc ? x8 y8) ⊗ + (eqc ? x9 y9) ⊗ (eqc ? x10 y10) ⊗ (eqc ? x11 y11) ⊗ (eqc ? x12 y12)) = true); + nrewrite > (eqc_to_eq … (andb_true_true_r … H)); + nletin H1 ≝ (andb_true_true_l … H); + nrewrite > (eqc_to_eq … (andb_true_true_r … H1)); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (eqc_to_eq … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (eqc_to_eq … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (eqc_to_eq … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (eqc_to_eq … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (eqc_to_eq … (andb_true_true_r … H6)); + nletin H7 ≝ (andb_true_true_l … H6); + nrewrite > (eqc_to_eq … (andb_true_true_r … H7)); + nletin H8 ≝ (andb_true_true_l … H7); + nrewrite > (eqc_to_eq … (andb_true_true_r … H8)); + nletin H9 ≝ (andb_true_true_l … H8); + nrewrite > (eqc_to_eq … (andb_true_true_r … H9)); + nletin H10 ≝ (andb_true_true_l … H9); + nrewrite > (eqc_to_eq … (andb_true_true_r … H10)); + nrewrite > (eqc_to_eq … (andb_true_true_l … H10)); + napply refl_eq. +nqed. + +nlemma neq_to_neqaluHC08 : ∀alu1,alu2.alu1 ≠ alu2 → eq_HC08_alu alu1 alu2 = false. + #s1; #s2; #H; + napply (neqtrue_to_eqfalse (eq_HC08_alu s1 s2)); + napply (not_to_not (eq_HC08_alu s1 s2 = true) (s1 = s2) ? H); + napply (eqaluHC08_to_eq s1 s2). +nqed. + +nlemma decidable_aluHC08 : ∀x,y:alu_HC08.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_HC08_alu x y = true) (eq_HC08_alu x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqaluHC08_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqaluHC08_to_neq … H)) + ##] +nqed. + +nlemma symmetric_eqaluHC08 : symmetricT alu_HC08 bool eq_HC08_alu. + #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 ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ (eqc ? x7 y7) ⊗ (eqc ? x8 y8) ⊗ + (eqc ? x9 y9) ⊗ (eqc ? x10 y10) ⊗ (eqc ? x11 y11) ⊗ (eqc ? x12 y12)) = + ((eqc ? y1 x1) ⊗ (eqc ? y2 x2) ⊗ (eqc ? y3 x3) ⊗ (eqc ? y4 x4) ⊗ + (eqc ? y5 x5) ⊗ (eqc ? y6 x6) ⊗ (eqc ? y7 x7) ⊗ (eqc ? y8 x8) ⊗ + (eqc ? y9 x9) ⊗ (eqc ? y10 x10) ⊗ (eqc ? y11 x11) ⊗ (eqc ? y12 x12))); + nrewrite > (symmetric_eqc ? x1 y1); + nrewrite > (symmetric_eqc ? x2 y2); + nrewrite > (symmetric_eqc ? x3 y3); + nrewrite > (symmetric_eqc ? x4 y4); + nrewrite > (symmetric_eqc ? x5 y5); + nrewrite > (symmetric_eqc ? x6 y6); + nrewrite > (symmetric_eqc ? x7 y7); + nrewrite > (symmetric_eqc ? x8 y8); + nrewrite > (symmetric_eqc ? x9 y9); + nrewrite > (symmetric_eqc ? x10 y10); + nrewrite > (symmetric_eqc ? x11 y11); + nrewrite > (symmetric_eqc ? x12 y12); + napply refl_eq. +nqed. + +nlemma aluHC08_is_comparable : comparable. + @ alu_HC08 + ##[ napply (mk_alu_HC08 (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?)) + ##| napply forall_HC08_alu + ##| napply eq_HC08_alu + ##| napply eqaluHC08_to_eq + ##| napply eq_to_eqaluHC08 + ##| napply neqaluHC08_to_neq + ##| napply neq_to_neqaluHC08 + ##| napply decidable_aluHC08 + ##| napply symmetric_eqaluHC08 + ##] +nqed. + +unification hint 0 ≔ ⊢ carr aluHC08_is_comparable ≡ alu_HC08. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status_base.ma new file mode 100755 index 000000000..015d5926e --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/HC08_status_base.ma @@ -0,0 +1,318 @@ +(**************************************************************************) +(* ___ *) +(* ||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". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +(* 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). + +(* ****** *) +(* SETTER *) +(* ****** *) + +(* 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 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 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 specifico HC08/HCS08 di H:X *) +ndefinition set_indX_16_reg_HC08 ≝ +λalu.λindx16:word16. + mk_alu_HC08 + (acc_low_reg_HC08 alu) + (cnL ? indx16) + (cnH ? 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 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 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 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 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 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 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 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 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 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'. + +(* ***************** *) +(* CONFRONTO FRA ALU *) +(* ***************** *) + +(* confronto registro per registro dell'HC08 *) +ndefinition eq_HC08_alu ≝ +λalu1,alu2:alu_HC08. + (eqc ? (acc_low_reg_HC08 alu1) (acc_low_reg_HC08 alu2)) ⊗ + (eqc ? (indX_low_reg_HC08 alu1) (indX_low_reg_HC08 alu2)) ⊗ + (eqc ? (indX_high_reg_HC08 alu1) (indX_high_reg_HC08 alu2)) ⊗ + (eqc ? (sp_reg_HC08 alu1) (sp_reg_HC08 alu2)) ⊗ + (eqc ? (pc_reg_HC08 alu1) (pc_reg_HC08 alu2)) ⊗ + (eqc ? (v_flag_HC08 alu1) (v_flag_HC08 alu2)) ⊗ + (eqc ? (h_flag_HC08 alu1) (h_flag_HC08 alu2)) ⊗ + (eqc ? (i_flag_HC08 alu1) (i_flag_HC08 alu2)) ⊗ + (eqc ? (n_flag_HC08 alu1) (n_flag_HC08 alu2)) ⊗ + (eqc ? (z_flag_HC08 alu1) (z_flag_HC08 alu2)) ⊗ + (eqc ? (c_flag_HC08 alu1) (c_flag_HC08 alu2)) ⊗ + (eqc ? (irq_flag_HC08 alu1) (irq_flag_HC08 alu2)). + +ndefinition forall_HC08_alu ≝ λP:alu_HC08 → bool. + forallc ? (λr1.forallc ? (λr2. + forallc ? (λr3.forallc ? (λr4. + forallc ? (λr5.forallc ? (λr6. + forallc ? (λr7.forallc ? (λr8. + forallc ? (λr9.forallc ? (λr10. + forallc ? (λr11.forallc ? (λr12. + P (mk_alu_HC08 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12))))))))))))). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status.ma new file mode 100755 index 000000000..332b21e53 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status.ma @@ -0,0 +1,416 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/status/IP2022_status_base.ma". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +nlemma aluIP2022_destruct_1 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x1 = y1. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 a _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x1 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_2 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x2 = y2. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ a _ _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x2 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_3 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x3 = y3. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ a _ _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x3 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_4 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x4 = y4. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ a _ _ _ _ _ _ _ _ _ _ _ _ ⇒ x4 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_5 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x5 = y5. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ a _ _ _ _ _ _ _ _ _ _ _ ⇒ x5 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_6 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x6 = y6. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ a _ _ _ _ _ _ _ _ _ _ ⇒ x6 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_7 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x7 = y7. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ a _ _ _ _ _ _ _ _ _ ⇒ x7 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_8 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x8 = y8. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ a _ _ _ _ _ _ _ _ ⇒ x8 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_9 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x9 = y9. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ a _ _ _ _ _ _ _ ⇒ x9 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_10 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x10 = y10. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ a _ _ _ _ _ _ ⇒ x10 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_11 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x11 = y11. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ a _ _ _ _ _ ⇒ x11 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_12 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x12 = y12. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ _ a _ _ _ _ ⇒ x12 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_13 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x13 = y13. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ _ _ a _ _ _ ⇒ x13 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_14 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x14 = y14. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ _ _ _ a _ _ ⇒ x14 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_15 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x15 = y15. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ _ _ _ _ a _ ⇒ x15 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +nlemma aluIP2022_destruct_16 : +∀x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16. + mk_alu_IP2022 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 = + mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 → + x16 = y16. + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange with (match mk_alu_IP2022 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 + with [ mk_alu_IP2022 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ a ⇒ x16 = a ]); + nrewrite < H; + nnormalize; + napply refl_eq. +nqed. + +(* !!! ci mette troppo tempo a compilare *) +naxiom eq_to_eqaluIP2022 : ∀alu1,alu2.alu1 = alu2 → eq_IP2022_alu alu1 alu2 = true. +(* #alu1; ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; #x9; #x10; #x11; #x12; #x13; #x14; #x15; #x16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nrewrite > (aluIP2022_destruct_1 … H); + nrewrite > (aluIP2022_destruct_2 … H); + nrewrite > (aluIP2022_destruct_3 … H); + nrewrite > (aluIP2022_destruct_4 … H); + nrewrite > (aluIP2022_destruct_5 … H); + nrewrite > (aluIP2022_destruct_6 … H); + nrewrite > (aluIP2022_destruct_7 … H); + nrewrite > (aluIP2022_destruct_8 … H); + nrewrite > (aluIP2022_destruct_9 … H); + nrewrite > (aluIP2022_destruct_10 … H); + nrewrite > (aluIP2022_destruct_11 … H); + nrewrite > (aluIP2022_destruct_12 … H); + nrewrite > (aluIP2022_destruct_13 … H); + nrewrite > (aluIP2022_destruct_14 … H); + nrewrite > (aluIP2022_destruct_15 … H); + nrewrite > (aluIP2022_destruct_16 … H); + nchange with ( + ((eqc ? y1 y1) ⊗ (eqc ? y2 y2) ⊗ (eqc ? y3 y3) ⊗ (eqc ? y4 y4) ⊗ + (eqc ? y5 y5) ⊗ (eqc ? y6 y6) ⊗ (eqc ? y7 y7) ⊗ (eqc ? y8 y8) ⊗ + (eqc ? y9 y9) ⊗ (eqc ? y10 y10) ⊗ (eqc ? y11 y11) ⊗ (eqc ? y12 y12) ⊗ + (eqc ? y13 y13) ⊗ (eqc ? y14 y14) ⊗ (eqc ? y15 y15) ⊗ (eqc ? y16 y16)) = true); + nrewrite > (eq_to_eqc ? y1 y1 (refl_eq …)); + nrewrite > (eq_to_eqc ? y2 y2 (refl_eq …)); + nrewrite > (eq_to_eqc ? y3 y3 (refl_eq …)); + nrewrite > (eq_to_eqc ? y4 y4 (refl_eq …)); + nrewrite > (eq_to_eqc ? y5 y5 (refl_eq …)); + nrewrite > (eq_to_eqc ? y6 y6 (refl_eq …)); + nrewrite > (eq_to_eqc ? y7 y7 (refl_eq …)); + nrewrite > (eq_to_eqc ? y8 y8 (refl_eq …)); + nrewrite > (eq_to_eqc ? y9 y9 (refl_eq …)); + nrewrite > (eq_to_eqc ? y10 y10 (refl_eq …)); + nrewrite > (eq_to_eqc ? y11 y11 (refl_eq …)); + nrewrite > (eq_to_eqc ? y12 y12 (refl_eq …)); + nrewrite > (eq_to_eqc ? y13 y13 (refl_eq …)); + nrewrite > (eq_to_eqc ? y14 y14 (refl_eq …)); + nrewrite > (eq_to_eqc ? y15 y15 (refl_eq …)); + nrewrite > (eq_to_eqc ? y16 y16 (refl_eq …)); + napply refl_eq. +nqed.*) + +nlemma neqaluIP2022_to_neq : ∀alu1,alu2.eq_IP2022_alu alu1 alu2 = false → alu1 ≠ alu2. + #s1; #s2; #H; + napply (not_to_not (s1 = s2) (eq_IP2022_alu s1 s2 = true) …); + ##[ ##1: napply (eq_to_eqaluIP2022 s1 s2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqaluIP2022_to_eq : ∀alu1,alu2.eq_IP2022_alu alu1 alu2 = true → alu1 = alu2. + #alu1; ncases alu1; + #z1; #z2; #z3; #z4; #z5; #z6; #z7; #z8; #z9; #z10; #z11; #z12; #z13; #z14; #z15; #z16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; #H; + nchange in H:(%) with ( + ((eqc ? z1 y1) ⊗ (eqc ? z2 y2) ⊗ (eqc ? z3 y3) ⊗ (eqc ? z4 y4) ⊗ + (eqc ? z5 y5) ⊗ (eqc ? z6 y6) ⊗ (eqc ? z7 y7) ⊗ (eqc ? z8 y8) ⊗ + (eqc ? z9 y9) ⊗ (eqc ? z10 y10) ⊗ (eqc ? z11 y11) ⊗ (eqc ? z12 y12) ⊗ + (eqc ? z13 y13) ⊗ (eqc ? z14 y14) ⊗ (eqc ? z15 y15) ⊗ (eqc ? z16 y16)) = true); + nrewrite > (eqc_to_eq … (andb_true_true_r … H)); + nletin H1 ≝ (andb_true_true_l … H); + nrewrite > (eqc_to_eq … (andb_true_true_r … (andb_true_true_l … H))); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (eqc_to_eq … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (eqc_to_eq … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (eqc_to_eq … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (eqc_to_eq … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (eqc_to_eq … (andb_true_true_r … H6)); + nletin H7 ≝ (andb_true_true_l … H6); + nrewrite > (eqc_to_eq … (andb_true_true_r … H7)); + nletin H8 ≝ (andb_true_true_l … H7); + nrewrite > (eqc_to_eq … (andb_true_true_r … H8)); + nletin H9 ≝ (andb_true_true_l … H8); + nrewrite > (eqc_to_eq … (andb_true_true_r … H9)); + nletin H10 ≝ (andb_true_true_l … H9); + nrewrite > (eqc_to_eq … (andb_true_true_r … H10)); + nletin H11 ≝ (andb_true_true_l … H10); + nrewrite > (eqc_to_eq … (andb_true_true_r … H11)); + nletin H12 ≝ (andb_true_true_l … H11); + nrewrite > (eqc_to_eq … (andb_true_true_r … H12)); + nletin H13 ≝ (andb_true_true_l … H12); + nrewrite > (eqc_to_eq … (andb_true_true_r … H13)); + nletin H14 ≝ (andb_true_true_l … H13); + nrewrite > (eqc_to_eq … (andb_true_true_r … H14)); + nrewrite > (eqc_to_eq … (andb_true_true_l … H14)); + napply refl_eq. +nqed. + +nlemma neq_to_neqaluIP2022 : ∀alu1,alu2.alu1 ≠ alu2 → eq_IP2022_alu alu1 alu2 = false. + #s1; #s2; #H; + napply (neqtrue_to_eqfalse (eq_IP2022_alu s1 s2)); + napply (not_to_not (eq_IP2022_alu s1 s2 = true) (s1 = s2) ? H); + napply (eqaluIP2022_to_eq s1 s2). +nqed. + +nlemma decidable_aluIP2022 : ∀x,y:alu_IP2022.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_IP2022_alu x y = true) (eq_IP2022_alu x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqaluIP2022_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqaluIP2022_to_neq … H)) + ##] +nqed. + +(* !!! ci mette troppo tempo a compilare *) +naxiom symmetric_eqaluIP2022 : symmetricT alu_IP2022 bool eq_IP2022_alu. +(* #alu1; ncases alu1; + #z1; #z2; #z3; #z4; #z5; #z6; #z7; #z8; #z9; #z10; #z11; #z12; #z13; #z14; #z15; #z16; + #alu2; ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; #y9; #y10; #y11; #y12; #y13; #y14; #y15; #y16; + nchange with ( + ((eqc ? z1 y1) ⊗ (eqc ? z2 y2) ⊗ (eqc ? z3 y3) ⊗ (eqc ? z4 y4) ⊗ + (eqc ? z5 y5) ⊗ (eqc ? z6 y6) ⊗ (eqc ? z7 y7) ⊗ (eqc ? z8 y8) ⊗ + (eqc ? z9 y9) ⊗ (eqc ? z10 y10) ⊗ (eqc ? z11 y11) ⊗ (eqc ? z12 y12) ⊗ + (eqc ? z13 y13) ⊗ (eqc ? z14 y14) ⊗ (eqc ? z15 y15) ⊗ (eqc ? z16 y16)) = + ((eqc ? y1 z1) ⊗ (eqc ? y2 z2) ⊗ (eqc ? y3 z3) ⊗ (eqc ? y4 z4) ⊗ + (eqc ? y5 z5) ⊗ (eqc ? y6 z6) ⊗ (eqc ? y7 z7) ⊗ (eqc ? y8 z8) ⊗ + (eqc ? y9 z9) ⊗ (eqc ? y10 z10) ⊗ (eqc ? y11 z11) ⊗ (eqc ? y12 z12) ⊗ + (eqc ? y13 z13) ⊗ (eqc ? y14 z14) ⊗ (eqc ? y15 z15) ⊗ (eqc ? y16 z16))); + nrewrite > (symmetric_eqc ? z1 y1); + nrewrite > (symmetric_eqc ? z2 y2); + nrewrite > (symmetric_eqc ? z3 y3); + nrewrite > (symmetric_eqc ? z4 y4); + nrewrite > (symmetric_eqc ? z5 y5); + nrewrite > (symmetric_eqc ? z6 y6); + nrewrite > (symmetric_eqc ? z7 y7); + nrewrite > (symmetric_eqc ? z8 y8); + nrewrite > (symmetric_eqc ? z9 y9); + nrewrite > (symmetric_eqc ? z10 y10); + nrewrite > (symmetric_eqc ? z11 y11); + nrewrite > (symmetric_eqc ? z12 y12); + nrewrite > (symmetric_eqc ? z13 y13); + nrewrite > (symmetric_eqc ? z14 y14); + nrewrite > (symmetric_eqc ? z15 y15); + nrewrite > (symmetric_eqc ? z16 y16); + napply refl_eq. +nqed.*) + +nlemma aluIP2022_is_comparable : comparable. + @ alu_IP2022 + ##[ napply (mk_alu_IP2022 (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?)) + ##| napply forall_IP2022_alu + ##| napply eq_IP2022_alu + ##| napply eqaluIP2022_to_eq + ##| napply eq_to_eqaluIP2022 + ##| napply neqaluIP2022_to_neq + ##| napply neq_to_neqaluIP2022 + ##| napply decidable_aluIP2022 + ##| napply symmetric_eqaluIP2022 + ##] +nqed. + +unification hint 0 ≔ ⊢ carr aluIP2022_is_comparable ≡ alu_IP2022. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma new file mode 100755 index 000000000..340fafeb4 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/IP2022_status_base.ma @@ -0,0 +1,585 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_struct.ma". +include "num/word16.ma". +include "num/word24.ma". + +(* ******************************** *) +(* IP2022 REGISTER SPECIAL HARDWARE *) +(* ******************************** *) + +(* (Top Of Stack) : CALLH/CALL ↑ CALLH/CALL ↓ *) +(* Pos2-15 : ... ↑ ... ↓ *) +(* Pos16 : 0xFFFF ↑ ... ↓ *) +ndefinition aux_callstack_type ≝ Array16T word16. + +(* Top Of Stack : 0xFFFF on reset *) +ndefinition new_callstack ≝ + mk_Array16T ? (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) + (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) + (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) + (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉) (〈〈xF,xF〉:〈xF,xF〉〉). + +ndefinition pop_callstack ≝ +λcs:aux_callstack_type. + pair … (a16_1 ? cs) + (mk_Array16T ? (a16_2 ? cs) (a16_3 ? cs) (a16_4 ? cs) (a16_5 ? cs) + (a16_6 ? cs) (a16_7 ? cs) (a16_8 ? cs) (a16_9 ? cs) + (a16_10 ? cs) (a16_11 ? cs) (a16_12 ? cs) (a16_13 ? cs) + (a16_14 ? cs) (a16_15 ? cs) (a16_16 ? cs) 〈〈xF,xF〉:〈xF,xF〉〉). + +ndefinition push_callstack ≝ +λcs:aux_callstack_type.λtop. + mk_Array16T ? top (a16_1 ? cs) (a16_2 ? cs) (a16_3 ? cs) + (a16_4 ? cs) (a16_5 ? cs) (a16_6 ? cs) (a16_7 ? cs) + (a16_8 ? cs) (a16_9 ? cs) (a16_10 ? cs) (a16_11 ? cs) + (a16_12 ? cs) (a16_13 ? cs) (a16_14 ? cs) (a16_15 ? cs). + +nlemma callstack_is_comparable : comparable. + @ (aux_callstack_type) + ##[ napply (zeroc (ar16_is_comparable word16_is_comparable)) + ##| napply (forallc (ar16_is_comparable word16_is_comparable)) + ##| napply (eqc (ar16_is_comparable word16_is_comparable)) + ##| napply (eqc_to_eq (ar16_is_comparable word16_is_comparable)) + ##| napply (eq_to_eqc (ar16_is_comparable word16_is_comparable)) + ##| napply (neqc_to_neq (ar16_is_comparable word16_is_comparable)) + ##| napply (neq_to_neqc (ar16_is_comparable word16_is_comparable)) + ##| napply (decidable_c (ar16_is_comparable word16_is_comparable)) + ##| napply (symmetric_eqc (ar16_is_comparable word16_is_comparable)) + ##] +nqed. + +unification hint 0 ≔ ⊢ carr callstack_is_comparable ≡ aux_callstack_type. + +(* array ad accesso diretto di 8 registri ADDR a 24bit *) +(* selezione con registro ADDRSEL, solo i primi 3bit validi *) +ndefinition aux_addrarray_type ≝ Array8T word24. + +(* tutti a 0x000000 on reset *) +ndefinition new_addrarray ≝ + mk_Array8T ? (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) + (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) + (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) + (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉) (〈〈x0,x0〉;〈x0,x0〉;〈x0,x0〉〉). + +ndefinition get_addrarray ≝ +λaddrsel:byte8.λaa:aux_addrarray_type. + getn_array8T (oct_of_exL (cnL ? addrsel)) ? aa. + +ndefinition set_addrarray ≝ +λaddrsel:byte8.λaa:aux_addrarray_type.λv. + setn_array8T (oct_of_exL (cnL ? addrsel)) ? aa v. + +nlemma addrarray_is_comparable : comparable. + @ (aux_addrarray_type) + ##[ napply (zeroc (ar8_is_comparable word24_is_comparable)) + ##| napply (forallc (ar8_is_comparable word24_is_comparable)) + ##| napply (eqc (ar8_is_comparable word24_is_comparable)) + ##| napply (eqc_to_eq (ar8_is_comparable word24_is_comparable)) + ##| napply (eq_to_eqc (ar8_is_comparable word24_is_comparable)) + ##| napply (neqc_to_neq (ar8_is_comparable word24_is_comparable)) + ##| napply (neq_to_neqc (ar8_is_comparable word24_is_comparable)) + ##| napply (decidable_c (ar8_is_comparable word24_is_comparable)) + ##| napply (symmetric_eqc (ar8_is_comparable word24_is_comparable)) + ##] +nqed. + +unification hint 0 ≔ ⊢ carr addrarray_is_comparable ≡ aux_addrarray_type. + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +(* ALU dell'IP2022 *) +nrecord alu_IP2022: Type ≝ + { + (* W: accumulatore *) + acc_low_reg_IP2022 : byte8; + (* MULH: parte alta moltiplicazione *) + mulh_reg_IP2022 : byte8; + + (* ADDRSEL: selettore di indirizzo *) + addrsel_reg_IP2022 : byte8; + (* ADDR [ADDRX|ADDRH|ADDRL] : array indirizzi indicizzati da ADDRSEL *) + addr_array_IP2022 : aux_addrarray_type; + + (* CALL [CALLH|CALLL] : stack indirizzi di ritorno *) + call_stack_IP2022 : aux_callstack_type; + + (* IP [IPH|IPL] : indirect pointer *) + ip_reg_IP2022 : word16; + (* DP [DPH|DPL] : data pointer *) + dp_reg_IP2022 : word16; + (* DATA [DATAH|DATAL] : data value *) + data_reg_IP2022 : word16; + (* SP [SPH|SPL] : stack pointer *) + sp_reg_IP2022 : word16; + (* PC [PCH|PCL] : program counter *) + pc_reg_IP2022 : word16; + + (* SPEED[xxxxSSSS] : divisore del clock *) + speed_reg_IP2022 : exadecim; + (* PAGE [PPPxxxxx] : selettore pagina *) + page_reg_IP2022 : oct; + + (* H: flag semi-carry (somma nibble basso) *) + h_flag_IP2022 : bool; + (* Z: flag zero *) + z_flag_IP2022 : bool; + (* C: flag carry *) + c_flag_IP2022 : bool; + + (* skip mode : effettua fetch-decode, no execute *) + skip_mode_IP2022 : bool + }. + +notation "{hvbox('W_Reg' ≝ w ; break 'MulH_Reg' ≝ mulh ; break 'Addrsel_Reg' ≝ addrsel ; break 'Addr_Array' ≝ addr ; break 'Call_Stack' ≝ call ; break 'Ip_Reg' ≝ ip ; break 'Dp_Reg' ≝ dp ; break 'Data_Reg' ≝ data ; break 'Sp_Reg' ≝ sp ; break 'Pc_Reg' ≝ pc ; break 'Speed_Reg' ≝ speed ; break 'Page_Reg' ≝ page ; break 'H_Flag' ≝ hfl ; break 'Z_Flag' ≝ zfl ; break 'C_Flag' ≝ cfl ; break 'Skip_Mode' ≝ skipmode)}" + non associative with precedence 80 for + @{ 'mk_alu_IP2022 $w $mulh $addrsel $addr $call $ip $dp $data $sp $pc $speed $page $hfl $zfl $cfl $skipmode }. +interpretation "mk_alu_IP2022" 'mk_alu_IP2022 w mulh addrsel addr call ip dp data sp pc speed page hfl zfl cfl skipmode = + (mk_alu_IP2022 w mulh addrsel addr call ip dp data sp pc speed page hfl zfl cfl skipmode). + +(* ****** *) +(* SETTER *) +(* ****** *) + +(* setter specifico IP2022 di A *) +ndefinition set_acc_8_low_reg_IP2022 ≝ +λalu.λacclow':byte8. + mk_alu_IP2022 + acclow' + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di MULH *) +ndefinition set_mulh_reg_IP2022 ≝ +λalu.λmulh':byte8. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + mulh' + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di ADDRSEL *) +ndefinition set_addrsel_reg_IP2022 ≝ +λalu.λaddrsel':byte8. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + addrsel' + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di ADDR *) +ndefinition set_addr_reg_IP2022 ≝ +λalu.λaddr':word24. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (set_addrarray (addrsel_reg_IP2022 alu) (addr_array_IP2022 alu) addr') + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +ndefinition get_addr_reg_IP2022 ≝ +λalu.get_addrarray (addrsel_reg_IP2022 alu) (addr_array_IP2022 alu). + +(* setter specifico IP2022 di CALL *) +ndefinition set_call_reg_IP2022 ≝ +λalu.λcall':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (setn_array16T x0 ? (call_stack_IP2022 alu) call') + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +ndefinition get_call_reg_IP2022 ≝ +λalu.getn_array16T x0 ? (call_stack_IP2022 alu). + +ndefinition set_call_stack_IP2022 ≝ +λalu.λcall':aux_callstack_type. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + call' + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +ndefinition push_call_reg_IP2022 ≝ +λalu.λcall':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (push_callstack (call_stack_IP2022 alu) call') + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +ndefinition pop_call_reg_IP2022 ≝ +λalu.match pop_callstack (call_stack_IP2022 alu) with + [ pair val call' ⇒ pair … val (set_call_stack_IP2022 alu call') ]. + +(* setter specifico IP2022 di IP *) +ndefinition set_ip_reg_IP2022 ≝ +λalu.λip':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + ip' + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di DP *) +ndefinition set_dp_reg_IP2022 ≝ +λalu.λdp':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + dp' + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di DATA *) +ndefinition set_data_reg_IP2022 ≝ +λalu.λdata':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + data' + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di SP *) +ndefinition set_sp_reg_IP2022 ≝ +λalu.λsp':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + sp' + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di PC *) +ndefinition set_pc_reg_IP2022 ≝ +λalu.λpc':word16. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + pc' + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di SPEED *) +ndefinition set_speed_reg_IP2022 ≝ +λalu.λspeed':exadecim. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + speed' + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di PAGE *) +ndefinition set_page_reg_IP2022 ≝ +λalu.λpage':oct. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + page' + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di H *) +ndefinition set_h_flag_IP2022 ≝ +λalu.λhfl':bool. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + hfl' + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di Z *) +ndefinition set_z_flag_IP2022 ≝ +λalu.λzfl':bool. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + zfl' + (c_flag_IP2022 alu) + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di C *) +ndefinition set_c_flag_IP2022 ≝ +λalu.λcfl':bool. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + cfl' + (skip_mode_IP2022 alu). + +(* setter specifico IP2022 di SKIP *) +ndefinition set_skip_mode_IP2022 ≝ +λalu.λskipmode':bool. + mk_alu_IP2022 + (acc_low_reg_IP2022 alu) + (mulh_reg_IP2022 alu) + (addrsel_reg_IP2022 alu) + (addr_array_IP2022 alu) + (call_stack_IP2022 alu) + (ip_reg_IP2022 alu) + (dp_reg_IP2022 alu) + (data_reg_IP2022 alu) + (sp_reg_IP2022 alu) + (pc_reg_IP2022 alu) + (speed_reg_IP2022 alu) + (page_reg_IP2022 alu) + (h_flag_IP2022 alu) + (z_flag_IP2022 alu) + (c_flag_IP2022 alu) + skipmode'. + +(* ***************** *) +(* CONFRONTO FRA ALU *) +(* ***************** *) + +(* confronto registro per registro dell'IP2022 *) +ndefinition eq_IP2022_alu ≝ +λalu1,alu2:alu_IP2022. + (eqc ? (acc_low_reg_IP2022 alu1) (acc_low_reg_IP2022 alu2)) ⊗ + (eqc ? (mulh_reg_IP2022 alu1) (mulh_reg_IP2022 alu2)) ⊗ + (eqc ? (addrsel_reg_IP2022 alu1) (addrsel_reg_IP2022 alu2)) ⊗ + (eqc ? (addr_array_IP2022 alu1) (addr_array_IP2022 alu2)) ⊗ + (eqc ? (call_stack_IP2022 alu1) (call_stack_IP2022 alu2)) ⊗ + (eqc ? (ip_reg_IP2022 alu1) (ip_reg_IP2022 alu2)) ⊗ + (eqc ? (dp_reg_IP2022 alu1) (dp_reg_IP2022 alu2)) ⊗ + (eqc ? (data_reg_IP2022 alu1) (data_reg_IP2022 alu2)) ⊗ + (eqc ? (sp_reg_IP2022 alu1) (sp_reg_IP2022 alu2)) ⊗ + (eqc ? (pc_reg_IP2022 alu1) (pc_reg_IP2022 alu2)) ⊗ + (eqc ? (speed_reg_IP2022 alu1) (speed_reg_IP2022 alu2)) ⊗ + (eqc ? (page_reg_IP2022 alu1) (page_reg_IP2022 alu2)) ⊗ + (eqc ? (h_flag_IP2022 alu1) (h_flag_IP2022 alu2)) ⊗ + (eqc ? (z_flag_IP2022 alu1) (z_flag_IP2022 alu2)) ⊗ + (eqc ? (c_flag_IP2022 alu1) (c_flag_IP2022 alu2)) ⊗ + (eqc ? (skip_mode_IP2022 alu1) (skip_mode_IP2022 alu2)). + +ndefinition forall_IP2022_alu ≝ λP:alu_IP2022 → bool. + forallc ? (λr1.forallc ? (λr2. + forallc ? (λr3.forallc ? (λr4. + forallc ? (λr5.forallc ? (λr6. + forallc ? (λr7.forallc ? (λr8. + forallc ? (λr9.forallc ? (λr10. + forallc ? (λr11.forallc ? (λr12. + forallc ? (λr13.forallc ? (λr14. + forallc ? (λr15.forallc ? (λr16. + P (mk_alu_IP2022 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16))))))))))))))))). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status.ma new file mode 100755 index 000000000..538a5dd50 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status.ma @@ -0,0 +1,256 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/status/RS08_status_base.ma". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +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 eq_to_eqaluRS08 : ∀alu1,alu2.alu1 = alu2 → eq_RS08_alu 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 ( + ((eqc ? y1 y1) ⊗ (eqc ? y2 y2) ⊗ + (eqc ? y3 y3) ⊗ (eqc ? y4 y4) ⊗ + (eqc ? y5 y5) ⊗ (eqc ? y6 y6) ⊗ + (eqc ? y7 y7) ⊗ (eqc ? y8 y8)) = true); + nrewrite > (eq_to_eqc ? y1 y1 (refl_eq …)); + nrewrite > (eq_to_eqc ? y2 y2 (refl_eq …)); + nrewrite > (eq_to_eqc ? y3 y3 (refl_eq …)); + nrewrite > (eq_to_eqc ? y4 y4 (refl_eq …)); + nrewrite > (eq_to_eqc ? y5 y5 (refl_eq …)); + nrewrite > (eq_to_eqc ? y6 y6 (refl_eq …)); + nrewrite > (eq_to_eqc ? y7 y7 (refl_eq …)); + nrewrite > (eq_to_eqc ? y8 y8 (refl_eq …)); + napply refl_eq. +nqed. + +nlemma neqaluRS08_to_neq : ∀alu1,alu2.eq_RS08_alu alu1 alu2 = false → alu1 ≠ alu2. + #s1; #s2; #H; + napply (not_to_not (s1 = s2) (eq_RS08_alu s1 s2 = true) …); + ##[ ##1: napply (eq_to_eqaluRS08 s1 s2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqaluRS08_to_eq : ∀alu1,alu2.eq_RS08_alu 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 ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ + (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ + (eqc ? x7 y7) ⊗ (eqc ? x8 y8)) = true); + nrewrite > (eqc_to_eq … (andb_true_true_r … H)); + nletin H1 ≝ (andb_true_true_l … H); + nrewrite > (eqc_to_eq … (andb_true_true_r … H1)); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (eqc_to_eq … (andb_true_true_r … H2)); + nletin H3 ≝ (andb_true_true_l … H2); + nrewrite > (eqc_to_eq … (andb_true_true_r … H3)); + nletin H4 ≝ (andb_true_true_l … H3); + nrewrite > (eqc_to_eq … (andb_true_true_r … H4)); + nletin H5 ≝ (andb_true_true_l … H4); + nrewrite > (eqc_to_eq … (andb_true_true_r … H5)); + nletin H6 ≝ (andb_true_true_l … H5); + nrewrite > (eqc_to_eq … (andb_true_true_r … H6)); + nrewrite > (eqc_to_eq … (andb_true_true_l … H6)); + napply refl_eq. +nqed. + +nlemma neq_to_neqaluRS08 : ∀alu1,alu2.alu1 ≠ alu2 → eq_RS08_alu alu1 alu2 = false. + #s1; #s2; #H; + napply (neqtrue_to_eqfalse (eq_RS08_alu s1 s2)); + napply (not_to_not (eq_RS08_alu s1 s2 = true) (s1 = s2) ? H); + napply (eqaluRS08_to_eq s1 s2). +nqed. + +nlemma decidable_aluRS08 : ∀x,y:alu_RS08.decidable (x = y). + #x; #y; nnormalize; + napply (or2_elim (eq_RS08_alu x y = true) (eq_RS08_alu x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqaluRS08_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqaluRS08_to_neq … H)) + ##] +nqed. + + +nlemma symmetric_eqaluRS08 : symmetricT alu_RS08 bool eq_RS08_alu. + #alu1; #alu2; + ncases alu1; + #x1; #x2; #x3; #x4; #x5; #x6; #x7; #x8; + ncases alu2; + #y1; #y2; #y3; #y4; #y5; #y6; #y7; #y8; + nchange with ( + ((eqc ? x1 y1) ⊗ (eqc ? x2 y2) ⊗ + (eqc ? x3 y3) ⊗ (eqc ? x4 y4) ⊗ + (eqc ? x5 y5) ⊗ (eqc ? x6 y6) ⊗ + (eqc ? x7 y7) ⊗ (eqc ? x8 y8)) = + ((eqc ? y1 x1) ⊗ (eqc ? y2 x2) ⊗ + (eqc ? y3 x3) ⊗ (eqc ? y4 x4) ⊗ + (eqc ? y5 x5) ⊗ (eqc ? y6 x6) ⊗ + (eqc ? y7 x7) ⊗ (eqc ? y8 x8))); + nrewrite > (symmetric_eqc ? x1 y1); + nrewrite > (symmetric_eqc ? x2 y2); + nrewrite > (symmetric_eqc ? x3 y3); + nrewrite > (symmetric_eqc ? x4 y4); + nrewrite > (symmetric_eqc ? x5 y5); + nrewrite > (symmetric_eqc ? x6 y6); + nrewrite > (symmetric_eqc ? x7 y7); + nrewrite > (symmetric_eqc ? x8 y8); + napply refl_eq. +nqed. + +nlemma aluRS08_is_comparable : comparable. + @ alu_RS08 + ##[ napply (mk_alu_RS08 (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?) + (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?)) + ##| napply forall_RS08_alu + ##| napply eq_RS08_alu + ##| napply eqaluRS08_to_eq + ##| napply eq_to_eqaluRS08 + ##| napply neqaluRS08_to_neq + ##| napply neq_to_neqaluRS08 + ##| napply decidable_aluRS08 + ##| napply symmetric_eqaluRS08 + ##] +nqed. + +unification hint 0 ≔ ⊢ carr aluRS08_is_comparable ≡ alu_RS08. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status_base.ma new file mode 100755 index 000000000..510e37bb5 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/RS08_status_base.ma @@ -0,0 +1,183 @@ +(**************************************************************************) +(* ___ *) +(* ||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". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +(* 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] *) + 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] *) + 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). + +(* ****** *) +(* SETTER *) +(* ****** *) + +(* 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 specifico RS08 di PC, effettua PC∧mask *) +ndefinition set_pc_reg_RS08 ≝ +λalu.λpc':word16. + mk_alu_RS08 + (acc_low_reg_RS08 alu) + (andc ? 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 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) + (andc ? spc' (pc_mask_RS08 alu)) + (x_map_RS08 alu) + (ps_map_RS08 alu) + (z_flag_RS08 alu) + (c_flag_RS08 alu). + +(* 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 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 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 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'. + +(* ***************** *) +(* CONFRONTO FRA ALU *) +(* ***************** *) + +(* confronto registro per registro dell'RS08 *) +ndefinition eq_RS08_alu ≝ +λalu1,alu2:alu_RS08. + (eqc ? (acc_low_reg_RS08 alu1) (acc_low_reg_RS08 alu2)) ⊗ + (eqc ? (pc_reg_RS08 alu1) (pc_reg_RS08 alu2)) ⊗ + (eqc ? (pc_mask_RS08 alu1) (pc_mask_RS08 alu2)) ⊗ + (eqc ? (spc_reg_RS08 alu1) (spc_reg_RS08 alu2)) ⊗ + (eqc ? (x_map_RS08 alu1) (x_map_RS08 alu2)) ⊗ + (eqc ? (ps_map_RS08 alu1) (ps_map_RS08 alu2)) ⊗ + (eqc ? (z_flag_RS08 alu1) (z_flag_RS08 alu2)) ⊗ + (eqc ? (c_flag_RS08 alu1) (c_flag_RS08 alu2)). + +ndefinition forall_RS08_alu ≝ λP:alu_RS08 → bool. + forallc ? (λr1.forallc ? (λr2. + forallc ? (λr3.forallc ? (λr4. + forallc ? (λr5.forallc ? (λr6. + forallc ? (λr7.forallc ? (λr8. + P (mk_alu_RS08 r1 r2 r3 r4 r5 r6 r7 r8))))))))). diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/status.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/status.ma new file mode 100755 index 000000000..285438356 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/status.ma @@ -0,0 +1,192 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/status/status_base.ma". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +nlemma symmetric_forallmemoryranged : +∀t.∀chk1,chk2:aux_chk_type t.∀mem1,mem2:aux_mem_type t.∀sel.∀addrl. + forall_memory_ranged t chk1 chk2 mem1 mem2 sel addrl = + forall_memory_ranged t chk2 chk1 mem2 mem1 sel addrl. + #t; #chk1; #chk2; #mem1; #mem2; #sel; #addrl; + nelim addrl; + ##[ ##1: nnormalize; napply refl_eq + ##| ##2: #a; #l; #H; + nchange with ( + ((eqc ? (mem_read t mem1 chk1 sel a) + (mem_read t mem2 chk2 sel a)) ⊗ + (forall_memory_ranged t chk1 chk2 mem1 mem2 sel l)) = + ((eqc ? (mem_read t mem2 chk2 sel a) + (mem_read t mem1 chk1 sel a)) ⊗ + (forall_memory_ranged t chk2 chk1 mem2 mem1 sel l))); + nrewrite > H; + nrewrite > (symmetric_eqc ? … (mem_read t mem1 chk1 sel a) (mem_read t mem2 chk2 sel a)); + 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 eq_to_eqanystatus : ∀m,t.∀s1,s2:any_status m t.s1 = s2 → eq_anystatus m t s1 s2 = true. + #m; #t; + #s1; ncases s1; #alu1; #mem1; #chk1; #clk1; + #s2; ncases s2; #alu2; #mem2; #chk2; #clk2; + #H; + nrewrite > (anystatus_destruct_1 … H); + nrewrite > (anystatus_destruct_2 … H); + nrewrite > (anystatus_destruct_3 … H); + nrewrite > (anystatus_destruct_4 … H); + nchange with ( + ((eqc ? alu2 alu2) ⊗ (eqc ? mem2 mem2) ⊗ (eqc ? chk2 chk2) ⊗ (eqc ? clk2 clk2)) = true); + nrewrite > (eq_to_eqc ? alu2 alu2 (refl_eq …)); + nrewrite > (eq_to_eqc ? mem2 mem2 (refl_eq …)); + nrewrite > (eq_to_eqc ? chk2 chk2 (refl_eq …)); + nrewrite > (eq_to_eqc ? clk2 clk2 (refl_eq …)); + napply refl_eq. +nqed. + +nlemma neqanystatus_to_neq : ∀m,t.∀s1,s2:any_status m t.eq_anystatus m t s1 s2 = false → s1 ≠ s2. + #m; #t; #s1; #s2; #H; + napply (not_to_not (s1 = s2) (eq_anystatus m t s1 s2 = true) …); + ##[ ##1: napply (eq_to_eqanystatus m t s1 s2) + ##| ##2: napply (eqfalse_to_neqtrue … H) + ##] +nqed. + +nlemma eqanystatus_to_eq : ∀m,t.∀s1,s2:any_status m t.eq_anystatus m t s1 s2 = true → s1 = s2. + #m; #t; + #s1; ncases s1; #alu1; #mem1; #chk1; #clk1; + #s2; ncases s2; #alu2; #mem2; #chk2; #clk2; + nchange with ( + ((eqc ? alu1 alu2) ⊗ (eqc ? mem1 mem2) ⊗ (eqc ? chk1 chk2) ⊗ (eqc ? clk1 clk2)) = true → ?); + #H; + nrewrite > (eqc_to_eq … (andb_true_true_r … H)); + nletin H1 ≝ (andb_true_true_l … H); + nrewrite > (eqc_to_eq … (andb_true_true_r … H1)); + nletin H2 ≝ (andb_true_true_l … H1); + nrewrite > (eqc_to_eq … (andb_true_true_r … H2)); + nrewrite > (eqc_to_eq … (andb_true_true_l … H2)); + napply refl_eq. +nqed. + +nlemma neq_to_neqanystatus : ∀m,t.∀s1,s2:any_status m t.s1 ≠ s2 → eq_anystatus m t s1 s2 = false. + #m; #t; #s1; #s2; #H; + napply (neqtrue_to_eqfalse (eq_anystatus m t s1 s2)); + napply (not_to_not (eq_anystatus m t s1 s2 = true) (s1 = s2) ? H); + napply (eqanystatus_to_eq m t s1 s2). +nqed. + +nlemma decidable_anystatus : ∀m,t.∀x,y:any_status m t.decidable (x = y). + #m; #t; #x; #y; nnormalize; + napply (or2_elim (eq_anystatus m t x y = true) (eq_anystatus m t x y = false) ? (decidable_bexpr ?)); + ##[ ##1: #H; napply (or2_intro1 (x = y) (x ≠ y) (eqanystatus_to_eq … H)) + ##| ##2: #H; napply (or2_intro2 (x = y) (x ≠ y) (neqanystatus_to_neq … H)) + ##] +nqed. + +nlemma symmetric_eqanystatus : ∀m,t.symmetricT (any_status m t) bool (eq_anystatus m t). + #m; #t; + #s1; ncases s1; #alu1; #mem1; #chk1; #clk1; + #s2; ncases s2; #alu2; #mem2; #chk2; #clk2; + nchange with ( + ((eqc ? alu1 alu2) ⊗ (eqc ? mem1 mem2) ⊗ (eqc ? chk1 chk2) ⊗ (eqc ? clk1 clk2)) = + ((eqc ? alu2 alu1) ⊗ (eqc ? mem2 mem1) ⊗ (eqc ? chk2 chk1) ⊗ (eqc ? clk2 clk1))); + nrewrite > (symmetric_eqc … alu1 alu2); + nrewrite > (symmetric_eqc … mem1 mem2); + nrewrite > (symmetric_eqc … chk1 chk2); + nrewrite > (symmetric_eqc … clk1 clk2); + napply refl_eq. +nqed. + +nlemma anystatus_is_comparable : mcu_type → memory_impl → comparable. + #m; #t; @ (any_status m t) + ##[ napply (mk_any_status m t (zeroc ?) (zeroc ?) (zeroc ?) (zeroc ?)) + ##| napply forall_anystatus + ##| napply eq_anystatus + ##| napply eqanystatus_to_eq + ##| napply eq_to_eqanystatus + ##| napply neqanystatus_to_neq + ##| napply neq_to_neqanystatus + ##| napply decidable_anystatus + ##| napply symmetric_eqanystatus + ##] +nqed. + +unification hint 0 ≔ M:mcu_type, T:memory_impl ⊢ + carr (anystatus_is_comparable M T) ≡ any_status M T. diff --git a/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma new file mode 100755 index 000000000..b6d394c91 --- /dev/null +++ b/helm/software/matita/contribs/ng_assembly2/emulator/status/status_base.ma @@ -0,0 +1,171 @@ +(**************************************************************************) +(* ___ *) +(* ||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 "emulator/memory/memory_abs.ma". +include "emulator/status/HC05_status.ma". +include "emulator/status/HC08_status.ma". +include "emulator/status/RS08_status.ma". +include "emulator/status/IP2022_status.ma". +include "emulator/opcodes/pseudo.ma". + +(* *********************************** *) +(* STATUS INTERNO DEL PROCESSORE (ALU) *) +(* *********************************** *) + +(* descrittore del click = stato di avanzamento dell'esecuzione *) +(* 1) None = istruzione eseguita, attesa del fetch *) +(* 2) Some cur_clk,pseudo,mode,clks,cur_pc = fetch eseguito *) +ndefinition aux_clk_type ≝ λm:mcu_type.Prod5T byte8 (aux_pseudo_type m) (aux_im_type m) byte8 word16. + +nlemma clk_is_comparable : mcu_type → comparable. + #m; @ (aux_clk_type m) + ##[ napply (zeroc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (forallc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (eqc_to_eq (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (eq_to_eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (neqc_to_neq (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (neq_to_neqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (decidable_c (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##| napply (symmetric_eqc (quintuple_is_comparable byte8_is_comparable (pseudo_is_comparable m) (im_is_comparable m) byte8_is_comparable word16_is_comparable)) + ##] +nqed. + +unification hint 0 ≔ M:mcu_type ⊢ carr (clk_is_comparable M) ≡ aux_clk_type M. + +(* descritture della alu *) +ndefinition aux_alu_type ≝ +λm.match m with + [ HC05 ⇒ alu_HC05 + | HC08 ⇒ alu_HC08 + | HCS08 ⇒ alu_HC08 + | RS08 ⇒ alu_RS08 + | IP2022 ⇒ alu_IP2022 + ]. + +nlemma alu_is_comparable : mcu_type → comparable. + #m; @ (aux_alu_type m) + ##[ nelim m; + ##[ napply (zeroc aluHC05_is_comparable) + ##| napply (zeroc aluHC08_is_comparable) + ##| napply (zeroc aluHC08_is_comparable) + ##| napply (zeroc aluRS08_is_comparable) + ##| napply (zeroc aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (forallc aluHC05_is_comparable) + ##| napply (forallc aluHC08_is_comparable) + ##| napply (forallc aluHC08_is_comparable) + ##| napply (forallc aluRS08_is_comparable) + ##| napply (forallc aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (eqc aluHC05_is_comparable) + ##| napply (eqc aluHC08_is_comparable) + ##| napply (eqc aluHC08_is_comparable) + ##| napply (eqc aluRS08_is_comparable) + ##| napply (eqc aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (eqc_to_eq aluHC05_is_comparable) + ##| napply (eqc_to_eq aluHC08_is_comparable) + ##| napply (eqc_to_eq aluHC08_is_comparable) + ##| napply (eqc_to_eq aluRS08_is_comparable) + ##| napply (eqc_to_eq aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (eq_to_eqc aluHC05_is_comparable) + ##| napply (eq_to_eqc aluHC08_is_comparable) + ##| napply (eq_to_eqc aluHC08_is_comparable) + ##| napply (eq_to_eqc aluRS08_is_comparable) + ##| napply (eq_to_eqc aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (neqc_to_neq aluHC05_is_comparable) + ##| napply (neqc_to_neq aluHC08_is_comparable) + ##| napply (neqc_to_neq aluHC08_is_comparable) + ##| napply (neqc_to_neq aluRS08_is_comparable) + ##| napply (neqc_to_neq aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (neq_to_neqc aluHC05_is_comparable) + ##| napply (neq_to_neqc aluHC08_is_comparable) + ##| napply (neq_to_neqc aluHC08_is_comparable) + ##| napply (neq_to_neqc aluRS08_is_comparable) + ##| napply (neq_to_neqc aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (decidable_c aluHC05_is_comparable) + ##| napply (decidable_c aluHC08_is_comparable) + ##| napply (decidable_c aluHC08_is_comparable) + ##| napply (decidable_c aluRS08_is_comparable) + ##| napply (decidable_c aluIP2022_is_comparable) ##] + ##| nelim m; + ##[ napply (symmetric_eqc aluHC05_is_comparable) + ##| napply (symmetric_eqc aluHC08_is_comparable) + ##| napply (symmetric_eqc aluHC08_is_comparable) + ##| napply (symmetric_eqc aluRS08_is_comparable) + ##| napply (symmetric_eqc aluIP2022_is_comparable) ##] + ##] +nqed. + +unification hint 0 ≔ M:mcu_type ⊢ carr (alu_is_comparable M) ≡ aux_alu_type M. + +(* tipo processore dipendente dalla mcu, varia solo la ALU *) +nrecord any_status (mcu:mcu_type) (t:memory_impl): Type ≝ + { + (* descrittore della alu *) + alu : aux_alu_type mcu; + (* descritore della memoria *) + mem_desc : aux_mem_type t; + (* descrittore del tipo di memoria installata *) + chk_desc : aux_chk_type t; + (* descrittore del clik *) + clk_desc : option (aux_clk_type mcu) + }. + +(* 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). + +(* ******************** *) +(* CONFRONTO FRA STATUS *) +(* ******************** *) + +ndefinition eq_anystatus ≝ +λm,t.λs1,s2:any_status m t. + (eqc ? (alu … s1) (alu … s2)) ⊗ + (eqc ? (mem_desc … s1) (mem_desc … s2)) ⊗ + (eqc ? (chk_desc … s1) (chk_desc … s2)) ⊗ + (eqc ? (clk_desc … s1) (clk_desc … s2)). + +ndefinition forall_anystatus ≝ λm,t.λP:any_status m t → bool. + forallc ? (λr1.forallc ? (λr2. + forallc ? (λr3.forallc ? (λr4. + P (mk_any_status m t r1 r2 r3 r4))))). + +(* 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) + (sel:oct) (addrl:list word16) on addrl ≝ + match addrl return λ_.bool with + [ nil ⇒ true + | cons hd tl ⇒ (eqc ? (mem_read t mem1 chk1 sel hd) (mem_read t mem2 chk2 sel hd)) ⊗ + (forall_memory_ranged t chk1 chk2 mem1 mem2 sel tl) + ]. diff --git a/helm/software/matita/contribs/ng_assembly2/num/bitrigesim.ma b/helm/software/matita/contribs/ng_assembly2/num/bitrigesim.ma index 82c14bdc2..c717fc7f2 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/bitrigesim.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/bitrigesim.ma @@ -90,6 +90,510 @@ ndefinition forall_bit ≝ λP. 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 and *) +ndefinition and_bit ≝ +λe1,e2.match e1 with + [ t00 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t00 | t07 ⇒ t00 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t00 | t0B ⇒ t00 | t0C ⇒ t00 | t0D ⇒ t00 | t0E ⇒ t00 | t0F ⇒ t00 + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t00 | t13 ⇒ t00 | t14 ⇒ t00 | t15 ⇒ t00 | t16 ⇒ t00 | t17 ⇒ t00 + | t18 ⇒ t00 | t19 ⇒ t00 | t1A ⇒ t00 | t1B ⇒ t00 | t1C ⇒ t00 | t1D ⇒ t00 | t1E ⇒ t00 | t1F ⇒ t00 ] + | t01 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t00 | t07 ⇒ t01 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t00 | t0B ⇒ t01 | t0C ⇒ t00 | t0D ⇒ t01 | t0E ⇒ t00 | t0F ⇒ t01 + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t00 | t13 ⇒ t01 | t14 ⇒ t00 | t15 ⇒ t01 | t16 ⇒ t00 | t17 ⇒ t01 + | t18 ⇒ t00 | t19 ⇒ t01 | t1A ⇒ t00 | t1B ⇒ t01 | t1C ⇒ t00 | t1D ⇒ t01 | t1E ⇒ t00 | t1F ⇒ t01 ] + | t02 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t02 | t07 ⇒ t02 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t02 | t0B ⇒ t02 | t0C ⇒ t00 | t0D ⇒ t00 | t0E ⇒ t02 | t0F ⇒ t02 + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t02 | t13 ⇒ t02 | t14 ⇒ t00 | t15 ⇒ t00 | t16 ⇒ t02 | t17 ⇒ t02 + | t18 ⇒ t00 | t19 ⇒ t00 | t1A ⇒ t02 | t1B ⇒ t02 | t1C ⇒ t00 | t1D ⇒ t00 | t1E ⇒ t02 | t1F ⇒ t02 ] + | t03 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t02 | t07 ⇒ t03 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t02 | t0B ⇒ t03 | t0C ⇒ t00 | t0D ⇒ t01 | t0E ⇒ t02 | t0F ⇒ t03 + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t02 | t13 ⇒ t03 | t14 ⇒ t00 | t15 ⇒ t01 | t16 ⇒ t02 | t17 ⇒ t03 + | t18 ⇒ t00 | t19 ⇒ t01 | t1A ⇒ t02 | t1B ⇒ t03 | t1C ⇒ t00 | t1D ⇒ t01 | t1E ⇒ t02 | t1F ⇒ t03 ] + | t04 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t04 | t07 ⇒ t04 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t00 | t0B ⇒ t00 | t0C ⇒ t04 | t0D ⇒ t04 | t0E ⇒ t04 | t0F ⇒ t04 + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t00 | t13 ⇒ t00 | t14 ⇒ t04 | t15 ⇒ t04 | t16 ⇒ t04 | t17 ⇒ t04 + | t18 ⇒ t00 | t19 ⇒ t00 | t1A ⇒ t00 | t1B ⇒ t00 | t1C ⇒ t04 | t1D ⇒ t04 | t1E ⇒ t04 | t1F ⇒ t04 ] + | t05 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t04 | t07 ⇒ t05 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t00 | t0B ⇒ t01 | t0C ⇒ t04 | t0D ⇒ t05 | t0E ⇒ t04 | t0F ⇒ t05 + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t00 | t13 ⇒ t01 | t14 ⇒ t04 | t15 ⇒ t05 | t16 ⇒ t04 | t17 ⇒ t05 + | t18 ⇒ t00 | t19 ⇒ t01 | t1A ⇒ t00 | t1B ⇒ t01 | t1C ⇒ t04 | t1D ⇒ t05 | t1E ⇒ t04 | t1F ⇒ t05 ] + | t06 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t06 | t07 ⇒ t06 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t02 | t0B ⇒ t02 | t0C ⇒ t04 | t0D ⇒ t04 | t0E ⇒ t06 | t0F ⇒ t06 + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t02 | t13 ⇒ t02 | t14 ⇒ t04 | t15 ⇒ t04 | t16 ⇒ t06 | t17 ⇒ t06 + | t18 ⇒ t00 | t19 ⇒ t00 | t1A ⇒ t02 | t1B ⇒ t02 | t1C ⇒ t04 | t1D ⇒ t04 | t1E ⇒ t06 | t1F ⇒ t06 ] + | t07 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t06 | t07 ⇒ t07 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t02 | t0B ⇒ t03 | t0C ⇒ t04 | t0D ⇒ t05 | t0E ⇒ t06 | t0F ⇒ t07 + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t02 | t13 ⇒ t03 | t14 ⇒ t04 | t15 ⇒ t05 | t16 ⇒ t06 | t17 ⇒ t07 + | t18 ⇒ t00 | t19 ⇒ t01 | t1A ⇒ t02 | t1B ⇒ t03 | t1C ⇒ t04 | t1D ⇒ t05 | t1E ⇒ t06 | t1F ⇒ t07 ] + | t08 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t00 | t07 ⇒ t00 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t08 | t0B ⇒ t08 | t0C ⇒ t08 | t0D ⇒ t08 | t0E ⇒ t08 | t0F ⇒ t08 + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t00 | t13 ⇒ t00 | t14 ⇒ t00 | t15 ⇒ t00 | t16 ⇒ t00 | t17 ⇒ t00 + | t18 ⇒ t08 | t19 ⇒ t08 | t1A ⇒ t08 | t1B ⇒ t08 | t1C ⇒ t08 | t1D ⇒ t08 | t1E ⇒ t08 | t1F ⇒ t08 ] + | t09 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t00 | t07 ⇒ t01 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t08 | t0B ⇒ t09 | t0C ⇒ t08 | t0D ⇒ t09 | t0E ⇒ t08 | t0F ⇒ t09 + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t00 | t13 ⇒ t01 | t14 ⇒ t00 | t15 ⇒ t01 | t16 ⇒ t00 | t17 ⇒ t01 + | t18 ⇒ t08 | t19 ⇒ t09 | t1A ⇒ t08 | t1B ⇒ t09 | t1C ⇒ t08 | t1D ⇒ t09 | t1E ⇒ t08 | t1F ⇒ t09 ] + | t0A ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t02 | t07 ⇒ t02 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t0A | t0B ⇒ t0A | t0C ⇒ t08 | t0D ⇒ t08 | t0E ⇒ t0A | t0F ⇒ t0A + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t02 | t13 ⇒ t02 | t14 ⇒ t00 | t15 ⇒ t00 | t16 ⇒ t02 | t17 ⇒ t02 + | t18 ⇒ t08 | t19 ⇒ t08 | t1A ⇒ t0A | t1B ⇒ t0A | t1C ⇒ t08 | t1D ⇒ t08 | t1E ⇒ t0A | t1F ⇒ t0A ] + | t0B ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t02 | t07 ⇒ t03 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t0A | t0B ⇒ t0B | t0C ⇒ t08 | t0D ⇒ t09 | t0E ⇒ t0A | t0F ⇒ t0B + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t02 | t13 ⇒ t03 | t14 ⇒ t00 | t15 ⇒ t01 | t16 ⇒ t02 | t17 ⇒ t03 + | t18 ⇒ t08 | t19 ⇒ t09 | t1A ⇒ t0A | t1B ⇒ t0B | t1C ⇒ t08 | t1D ⇒ t09 | t1E ⇒ t0A | t1F ⇒ t0B ] + | t0C ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t04 | t07 ⇒ t04 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t08 | t0B ⇒ t08 | t0C ⇒ t0C | t0D ⇒ t0C | t0E ⇒ t0C | t0F ⇒ t0C + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t00 | t13 ⇒ t00 | t14 ⇒ t04 | t15 ⇒ t04 | t16 ⇒ t04 | t17 ⇒ t04 + | t18 ⇒ t08 | t19 ⇒ t08 | t1A ⇒ t08 | t1B ⇒ t08 | t1C ⇒ t0C | t1D ⇒ t0C | t1E ⇒ t0C | t1F ⇒ t0C ] + | t0D ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t04 | t07 ⇒ t05 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t08 | t0B ⇒ t09 | t0C ⇒ t0C | t0D ⇒ t0D | t0E ⇒ t0C | t0F ⇒ t0D + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t00 | t13 ⇒ t01 | t14 ⇒ t04 | t15 ⇒ t05 | t16 ⇒ t04 | t17 ⇒ t05 + | t18 ⇒ t08 | t19 ⇒ t09 | t1A ⇒ t08 | t1B ⇒ t09 | t1C ⇒ t0C | t1D ⇒ t0D | t1E ⇒ t0C | t1F ⇒ t0D ] + | t0E ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t06 | t07 ⇒ t06 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t0A | t0B ⇒ t0A | t0C ⇒ t0C | t0D ⇒ t0C | t0E ⇒ t0E | t0F ⇒ t0E + | t10 ⇒ t00 | t11 ⇒ t00 | t12 ⇒ t02 | t13 ⇒ t02 | t14 ⇒ t04 | t15 ⇒ t04 | t16 ⇒ t06 | t17 ⇒ t06 + | t18 ⇒ t08 | t19 ⇒ t08 | t1A ⇒ t0A | t1B ⇒ t0A | t1C ⇒ t0C | t1D ⇒ t0C | t1E ⇒ t0E | t1F ⇒ t0E ] + | t0F ⇒ match e2 with + [ t00 ⇒ 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 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t02 | t13 ⇒ t03 | t14 ⇒ t04 | t15 ⇒ t05 | t16 ⇒ t06 | t17 ⇒ t07 + | t18 ⇒ t08 | t19 ⇒ t09 | t1A ⇒ t0A | t1B ⇒ t0B | t1C ⇒ t0C | t1D ⇒ t0D | t1E ⇒ t0E | t1F ⇒ t0F ] + | t10 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t00 | t07 ⇒ t00 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t00 | t0B ⇒ t00 | t0C ⇒ t00 | t0D ⇒ t00 | t0E ⇒ t00 | t0F ⇒ t00 + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t10 | t13 ⇒ t10 | t14 ⇒ t10 | t15 ⇒ t10 | t16 ⇒ t10 | t17 ⇒ t10 + | t18 ⇒ t10 | t19 ⇒ t10 | t1A ⇒ t10 | t1B ⇒ t10 | t1C ⇒ t10 | t1D ⇒ t10 | t1E ⇒ t10 | t1F ⇒ t10 ] + | t11 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t00 | t07 ⇒ t01 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t00 | t0B ⇒ t01 | t0C ⇒ t00 | t0D ⇒ t01 | t0E ⇒ t00 | t0F ⇒ t01 + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t10 | t13 ⇒ t11 | t14 ⇒ t10 | t15 ⇒ t11 | t16 ⇒ t10 | t17 ⇒ t11 + | t18 ⇒ t10 | t19 ⇒ t11 | t1A ⇒ t10 | t1B ⇒ t11 | t1C ⇒ t10 | t1D ⇒ t11 | t1E ⇒ t10 | t1F ⇒ t11 ] + | t12 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t02 | t07 ⇒ t02 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t02 | t0B ⇒ t02 | t0C ⇒ t00 | t0D ⇒ t00 | t0E ⇒ t02 | t0F ⇒ t02 + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t12 | t13 ⇒ t12 | t14 ⇒ t10 | t15 ⇒ t10 | t16 ⇒ t12 | t17 ⇒ t12 + | t18 ⇒ t10 | t19 ⇒ t10 | t1A ⇒ t12 | t1B ⇒ t12 | t1C ⇒ t10 | t1D ⇒ t10 | t1E ⇒ t12 | t1F ⇒ t12 ] + | t13 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t02 | t07 ⇒ t03 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t02 | t0B ⇒ t03 | t0C ⇒ t00 | t0D ⇒ t01 | t0E ⇒ t02 | t0F ⇒ t03 + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t12 | t13 ⇒ t13 | t14 ⇒ t10 | t15 ⇒ t11 | t16 ⇒ t12 | t17 ⇒ t13 + | t18 ⇒ t10 | t19 ⇒ t11 | t1A ⇒ t12 | t1B ⇒ t13 | t1C ⇒ t10 | t1D ⇒ t11 | t1E ⇒ t12 | t1F ⇒ t13 ] + | t14 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t04 | t07 ⇒ t04 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t00 | t0B ⇒ t00 | t0C ⇒ t04 | t0D ⇒ t04 | t0E ⇒ t04 | t0F ⇒ t04 + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t10 | t13 ⇒ t10 | t14 ⇒ t14 | t15 ⇒ t14 | t16 ⇒ t14 | t17 ⇒ t14 + | t18 ⇒ t10 | t19 ⇒ t10 | t1A ⇒ t10 | t1B ⇒ t10 | t1C ⇒ t14 | t1D ⇒ t14 | t1E ⇒ t14 | t1F ⇒ t14 ] + | t15 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t04 | t07 ⇒ t05 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t00 | t0B ⇒ t01 | t0C ⇒ t04 | t0D ⇒ t05 | t0E ⇒ t04 | t0F ⇒ t05 + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t10 | t13 ⇒ t11 | t14 ⇒ t14 | t15 ⇒ t15 | t16 ⇒ t14 | t17 ⇒ t15 + | t18 ⇒ t10 | t19 ⇒ t11 | t1A ⇒ t10 | t1B ⇒ t11 | t1C ⇒ t14 | t1D ⇒ t15 | t1E ⇒ t14 | t1F ⇒ t15 ] + | t16 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t06 | t07 ⇒ t06 + | t08 ⇒ t00 | t09 ⇒ t00 | t0A ⇒ t02 | t0B ⇒ t02 | t0C ⇒ t04 | t0D ⇒ t04 | t0E ⇒ t06 | t0F ⇒ t06 + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t12 | t13 ⇒ t12 | t14 ⇒ t14 | t15 ⇒ t14 | t16 ⇒ t16 | t17 ⇒ t16 + | t18 ⇒ t10 | t19 ⇒ t10 | t1A ⇒ t12 | t1B ⇒ t12 | t1C ⇒ t14 | t1D ⇒ t14 | t1E ⇒ t16 | t1F ⇒ t16 ] + | t17 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t06 | t07 ⇒ t07 + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t02 | t0B ⇒ t03 | t0C ⇒ t04 | t0D ⇒ t05 | t0E ⇒ t06 | t0F ⇒ t07 + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t12 | t13 ⇒ t13 | t14 ⇒ t14 | t15 ⇒ t15 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t10 | t19 ⇒ t11 | t1A ⇒ t12 | t1B ⇒ t13 | t1C ⇒ t14 | t1D ⇒ t15 | t1E ⇒ t16 | t1F ⇒ t17 ] + | t18 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t00 | t07 ⇒ t00 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t08 | t0B ⇒ t08 | t0C ⇒ t08 | t0D ⇒ t08 | t0E ⇒ t08 | t0F ⇒ t08 + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t10 | t13 ⇒ t10 | t14 ⇒ t10 | t15 ⇒ t10 | t16 ⇒ t10 | t17 ⇒ t10 + | t18 ⇒ t18 | t19 ⇒ t18 | t1A ⇒ t18 | t1B ⇒ t18 | t1C ⇒ t18 | t1D ⇒ t18 | t1E ⇒ t18 | t1F ⇒ t18 ] + | t19 ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t00 | t07 ⇒ t01 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t08 | t0B ⇒ t09 | t0C ⇒ t08 | t0D ⇒ t09 | t0E ⇒ t08 | t0F ⇒ t09 + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t10 | t13 ⇒ t11 | t14 ⇒ t10 | t15 ⇒ t11 | t16 ⇒ t10 | t17 ⇒ t11 + | t18 ⇒ t18 | t19 ⇒ t19 | t1A ⇒ t18 | t1B ⇒ t19 | t1C ⇒ t18 | t1D ⇒ t19 | t1E ⇒ t18 | t1F ⇒ t19 ] + | t1A ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t00 | t05 ⇒ t00 | t06 ⇒ t02 | t07 ⇒ t02 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t0A | t0B ⇒ t0A | t0C ⇒ t08 | t0D ⇒ t08 | t0E ⇒ t0A | t0F ⇒ t0A + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t12 | t13 ⇒ t12 | t14 ⇒ t10 | t15 ⇒ t10 | t16 ⇒ t12 | t17 ⇒ t12 + | t18 ⇒ t18 | t19 ⇒ t18 | t1A ⇒ t1A | t1B ⇒ t1A | t1C ⇒ t18 | t1D ⇒ t18 | t1E ⇒ t1A | t1F ⇒ t1A ] + | t1B ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t02 | t07 ⇒ t03 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t0A | t0B ⇒ t0B | t0C ⇒ t08 | t0D ⇒ t09 | t0E ⇒ t0A | t0F ⇒ t0B + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t12 | t13 ⇒ t13 | t14 ⇒ t10 | t15 ⇒ t11 | t16 ⇒ t12 | t17 ⇒ t13 + | t18 ⇒ t18 | t19 ⇒ t19 | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t18 | t1D ⇒ t19 | t1E ⇒ t1A | t1F ⇒ t1B ] + | t1C ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t00 | t03 ⇒ t00 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t04 | t07 ⇒ t04 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t08 | t0B ⇒ t08 | t0C ⇒ t0C | t0D ⇒ t0C | t0E ⇒ t0C | t0F ⇒ t0C + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t10 | t13 ⇒ t10 | t14 ⇒ t14 | t15 ⇒ t14 | t16 ⇒ t14 | t17 ⇒ t14 + | t18 ⇒ t18 | t19 ⇒ t18 | t1A ⇒ t18 | t1B ⇒ t18 | t1C ⇒ t1C | t1D ⇒ t1C | t1E ⇒ t1C | t1F ⇒ t1C ] + | t1D ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t01 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t04 | t07 ⇒ t05 + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t08 | t0B ⇒ t09 | t0C ⇒ t0C | t0D ⇒ t0D | t0E ⇒ t0C | t0F ⇒ t0D + | t10 ⇒ t10 | t11 ⇒ t11 | t12 ⇒ t10 | t13 ⇒ t11 | t14 ⇒ t14 | t15 ⇒ t15 | t16 ⇒ t14 | t17 ⇒ t15 + | t18 ⇒ t18 | t19 ⇒ t19 | t1A ⇒ t18 | t1B ⇒ t19 | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1C | t1F ⇒ t1D ] + | t1E ⇒ match e2 with + [ t00 ⇒ t00 | t01 ⇒ t00 | t02 ⇒ t02 | t03 ⇒ t02 | t04 ⇒ t04 | t05 ⇒ t04 | t06 ⇒ t06 | t07 ⇒ t06 + | t08 ⇒ t08 | t09 ⇒ t08 | t0A ⇒ t0A | t0B ⇒ t0A | t0C ⇒ t0C | t0D ⇒ t0C | t0E ⇒ t0E | t0F ⇒ t0E + | t10 ⇒ t10 | t11 ⇒ t10 | t12 ⇒ t12 | t13 ⇒ t12 | t14 ⇒ t14 | t15 ⇒ t14 | t16 ⇒ t16 | t17 ⇒ t16 + | t18 ⇒ t18 | t19 ⇒ t18 | t1A ⇒ t1A | t1B ⇒ t1A | t1C ⇒ t1C | t1D ⇒ t1C | t1E ⇒ t1E | t1F ⇒ t1E ] + | t1F ⇒ match e2 with + [ t00 ⇒ 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 ] + ]. + +(* operatore or *) +ndefinition or_bit ≝ +λe1,e2.match e1 with + [ t00 ⇒ match e2 with + [ t00 ⇒ 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 ] + | t01 ⇒ match e2 with + [ t00 ⇒ t01 | t01 ⇒ t01 | t02 ⇒ t03 | t03 ⇒ t03 | t04 ⇒ t05 | t05 ⇒ t05 | t06 ⇒ t07 | t07 ⇒ t07 + | t08 ⇒ t09 | t09 ⇒ t09 | t0A ⇒ t0B | t0B ⇒ t0B | t0C ⇒ t0D | t0D ⇒ t0D | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t11 | t11 ⇒ t11 | t12 ⇒ t13 | t13 ⇒ t13 | t14 ⇒ t15 | t15 ⇒ t15 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t19 | t19 ⇒ t19 | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t02 ⇒ match e2 with + [ t00 ⇒ t02 | t01 ⇒ t03 | t02 ⇒ t02 | t03 ⇒ t03 | t04 ⇒ t06 | t05 ⇒ t07 | t06 ⇒ t06 | t07 ⇒ t07 + | t08 ⇒ t0A | t09 ⇒ t0B | t0A ⇒ t0A | t0B ⇒ t0B | t0C ⇒ t0E | t0D ⇒ t0F | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t12 | t11 ⇒ t13 | t12 ⇒ t12 | t13 ⇒ t13 | t14 ⇒ t16 | t15 ⇒ t17 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1A | t19 ⇒ t1B | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t03 ⇒ match e2 with + [ t00 ⇒ t03 | t01 ⇒ t03 | t02 ⇒ t03 | t03 ⇒ t03 | t04 ⇒ t07 | t05 ⇒ t07 | t06 ⇒ t07 | t07 ⇒ t07 + | t08 ⇒ t0B | t09 ⇒ t0B | t0A ⇒ t0B | t0B ⇒ t0B | t0C ⇒ t0F | t0D ⇒ t0F | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t13 | t11 ⇒ t13 | t12 ⇒ t13 | t13 ⇒ t13 | t14 ⇒ t17 | t15 ⇒ t17 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1B | t19 ⇒ t1B | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t04 ⇒ match e2 with + [ t00 ⇒ t04 | t01 ⇒ t05 | t02 ⇒ t06 | t03 ⇒ t07 | t04 ⇒ t04 | t05 ⇒ t05 | t06 ⇒ t06 | t07 ⇒ t07 + | t08 ⇒ t0C | t09 ⇒ t0D | t0A ⇒ t0E | t0B ⇒ t0F | t0C ⇒ t0C | t0D ⇒ t0D | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t14 | t11 ⇒ t15 | t12 ⇒ t16 | t13 ⇒ t17 | t14 ⇒ t14 | t15 ⇒ t15 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1C | t19 ⇒ t1D | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t05 ⇒ match e2 with + [ t00 ⇒ t05 | t01 ⇒ t05 | t02 ⇒ t07 | t03 ⇒ t07 | t04 ⇒ t05 | t05 ⇒ t05 | t06 ⇒ t07 | t07 ⇒ t07 + | t08 ⇒ t0D | t09 ⇒ t0D | t0A ⇒ t0F | t0B ⇒ t0F | t0C ⇒ t0D | t0D ⇒ t0D | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t15 | t11 ⇒ t15 | t12 ⇒ t17 | t13 ⇒ t17 | t14 ⇒ t15 | t15 ⇒ t15 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1D | t19 ⇒ t1D | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t06 ⇒ match e2 with + [ t00 ⇒ t06 | t01 ⇒ t07 | t02 ⇒ t06 | t03 ⇒ t07 | t04 ⇒ t06 | t05 ⇒ t07 | t06 ⇒ t06 | t07 ⇒ t07 + | t08 ⇒ t0E | t09 ⇒ t0F | t0A ⇒ t0E | t0B ⇒ t0F | t0C ⇒ t0E | t0D ⇒ t0F | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t16 | t11 ⇒ t17 | t12 ⇒ t16 | t13 ⇒ t17 | t14 ⇒ t16 | t15 ⇒ t17 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1E | t19 ⇒ t1F | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t07 ⇒ match e2 with + [ t00 ⇒ t07 | t01 ⇒ t07 | t02 ⇒ t07 | t03 ⇒ t07 | t04 ⇒ t07 | t05 ⇒ t07 | t06 ⇒ t07 | t07 ⇒ t07 + | t08 ⇒ t0F | t09 ⇒ t0F | t0A ⇒ t0F | t0B ⇒ t0F | t0C ⇒ t0F | t0D ⇒ t0F | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t17 | t11 ⇒ t17 | t12 ⇒ t17 | t13 ⇒ t17 | t14 ⇒ t17 | t15 ⇒ t17 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1F | t19 ⇒ t1F | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t08 ⇒ match e2 with + [ t00 ⇒ t08 | t01 ⇒ t09 | t02 ⇒ t0A | t03 ⇒ t0B | t04 ⇒ t0C | t05 ⇒ t0D | t06 ⇒ t0E | t07 ⇒ t0F + | t08 ⇒ t08 | t09 ⇒ t09 | t0A ⇒ t0A | t0B ⇒ t0B | t0C ⇒ t0C | t0D ⇒ t0D | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t18 | t11 ⇒ t19 | t12 ⇒ t1A | t13 ⇒ t1B | t14 ⇒ t1C | t15 ⇒ t1D | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t18 | t19 ⇒ t19 | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t09 ⇒ match e2 with + [ t00 ⇒ t09 | t01 ⇒ t09 | t02 ⇒ t0B | t03 ⇒ t0B | t04 ⇒ t0D | t05 ⇒ t0D | t06 ⇒ t0F | t07 ⇒ t0F + | t08 ⇒ t09 | t09 ⇒ t09 | t0A ⇒ t0B | t0B ⇒ t0B | t0C ⇒ t0D | t0D ⇒ t0D | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t19 | t11 ⇒ t19 | t12 ⇒ t1B | t13 ⇒ t1B | t14 ⇒ t1D | t15 ⇒ t1D | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t19 | t19 ⇒ t19 | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t0A ⇒ match e2 with + [ t00 ⇒ t0A | t01 ⇒ t0B | t02 ⇒ t0A | t03 ⇒ t0B | t04 ⇒ t0E | t05 ⇒ t0F | t06 ⇒ t0E | t07 ⇒ t0F + | t08 ⇒ t0A | t09 ⇒ t0B | t0A ⇒ t0A | t0B ⇒ t0B | t0C ⇒ t0E | t0D ⇒ t0F | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t1A | t11 ⇒ t1B | t12 ⇒ t1A | t13 ⇒ t1B | t14 ⇒ t1E | t15 ⇒ t1F | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1A | t19 ⇒ t1B | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t0B ⇒ match e2 with + [ t00 ⇒ t0B | t01 ⇒ t0B | t02 ⇒ t0B | t03 ⇒ t0B | t04 ⇒ t0F | t05 ⇒ t0F | t06 ⇒ t0F | t07 ⇒ t0F + | t08 ⇒ t0B | t09 ⇒ t0B | t0A ⇒ t0B | t0B ⇒ t0B | t0C ⇒ t0F | t0D ⇒ t0F | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t1B | t11 ⇒ t1B | t12 ⇒ t1B | t13 ⇒ t1B | t14 ⇒ t1F | t15 ⇒ t1F | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1B | t19 ⇒ t1B | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t0C ⇒ match e2 with + [ t00 ⇒ t0C | t01 ⇒ t0D | t02 ⇒ t0E | t03 ⇒ t0F | t04 ⇒ t0C | t05 ⇒ t0D | t06 ⇒ t0E | t07 ⇒ t0F + | t08 ⇒ t0C | t09 ⇒ t0D | t0A ⇒ t0E | t0B ⇒ t0F | t0C ⇒ t0C | t0D ⇒ t0D | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t1C | t11 ⇒ t1D | t12 ⇒ t1E | t13 ⇒ t1F | t14 ⇒ t1C | t15 ⇒ t1D | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1C | t19 ⇒ t1D | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t0D ⇒ match e2 with + [ t00 ⇒ t0D | t01 ⇒ t0D | t02 ⇒ t0F | t03 ⇒ t0F | t04 ⇒ t0D | t05 ⇒ t0D | t06 ⇒ t0F | t07 ⇒ t0F + | t08 ⇒ t0D | t09 ⇒ t0D | t0A ⇒ t0F | t0B ⇒ t0F | t0C ⇒ t0D | t0D ⇒ t0D | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t1D | t11 ⇒ t1D | t12 ⇒ t1F | t13 ⇒ t1F | t14 ⇒ t1D | t15 ⇒ t1D | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1D | t19 ⇒ t1D | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t0E ⇒ match e2 with + [ t00 ⇒ t0E | t01 ⇒ t0F | t02 ⇒ t0E | t03 ⇒ t0F | t04 ⇒ t0E | t05 ⇒ t0F | t06 ⇒ t0E | t07 ⇒ t0F + | t08 ⇒ t0E | t09 ⇒ t0F | t0A ⇒ t0E | t0B ⇒ t0F | t0C ⇒ t0E | t0D ⇒ t0F | t0E ⇒ t0E | t0F ⇒ t0F + | t10 ⇒ t1E | t11 ⇒ t1F | t12 ⇒ t1E | t13 ⇒ t1F | t14 ⇒ t1E | t15 ⇒ t1F | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1E | t19 ⇒ t1F | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t0F ⇒ match e2 with + [ t00 ⇒ t0F | t01 ⇒ t0F | t02 ⇒ t0F | t03 ⇒ t0F | t04 ⇒ t0F | t05 ⇒ t0F | t06 ⇒ t0F | t07 ⇒ t0F + | t08 ⇒ t0F | t09 ⇒ t0F | t0A ⇒ t0F | t0B ⇒ t0F | t0C ⇒ t0F | t0D ⇒ t0F | t0E ⇒ t0F | t0F ⇒ t0F + | t10 ⇒ t1F | t11 ⇒ t1F | t12 ⇒ t1F | t13 ⇒ t1F | t14 ⇒ t1F | t15 ⇒ t1F | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1F | t19 ⇒ t1F | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t10 ⇒ match e2 with + [ t00 ⇒ t10 | t01 ⇒ t11 | t02 ⇒ t12 | t03 ⇒ t13 | t04 ⇒ t14 | t05 ⇒ t15 | t06 ⇒ t16 | t07 ⇒ t17 + | t08 ⇒ t18 | t09 ⇒ t19 | t0A ⇒ t1A | t0B ⇒ t1B | t0C ⇒ t1C | t0D ⇒ t1D | t0E ⇒ t1E | t0F ⇒ t1F + | 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 ] + | t11 ⇒ match e2 with + [ t00 ⇒ t11 | t01 ⇒ t11 | t02 ⇒ t13 | t03 ⇒ t13 | t04 ⇒ t15 | t05 ⇒ t15 | t06 ⇒ t17 | t07 ⇒ t17 + | t08 ⇒ t19 | t09 ⇒ t19 | t0A ⇒ t1B | t0B ⇒ t1B | t0C ⇒ t1D | t0D ⇒ t1D | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t11 | t11 ⇒ t11 | t12 ⇒ t13 | t13 ⇒ t13 | t14 ⇒ t15 | t15 ⇒ t15 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t19 | t19 ⇒ t19 | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t12 ⇒ match e2 with + [ t00 ⇒ t12 | t01 ⇒ t13 | t02 ⇒ t12 | t03 ⇒ t13 | t04 ⇒ t16 | t05 ⇒ t17 | t06 ⇒ t16 | t07 ⇒ t17 + | t08 ⇒ t1A | t09 ⇒ t1B | t0A ⇒ t1A | t0B ⇒ t1B | t0C ⇒ t1E | t0D ⇒ t1F | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t12 | t11 ⇒ t13 | t12 ⇒ t12 | t13 ⇒ t13 | t14 ⇒ t16 | t15 ⇒ t17 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1A | t19 ⇒ t1B | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t13 ⇒ match e2 with + [ t00 ⇒ t13 | t01 ⇒ t13 | t02 ⇒ t13 | t03 ⇒ t13 | t04 ⇒ t17 | t05 ⇒ t17 | t06 ⇒ t17 | t07 ⇒ t17 + | t08 ⇒ t1B | t09 ⇒ t1B | t0A ⇒ t1B | t0B ⇒ t1B | t0C ⇒ t1F | t0D ⇒ t1F | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t13 | t11 ⇒ t13 | t12 ⇒ t13 | t13 ⇒ t13 | t14 ⇒ t17 | t15 ⇒ t17 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1B | t19 ⇒ t1B | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t14 ⇒ match e2 with + [ t00 ⇒ t14 | t01 ⇒ t15 | t02 ⇒ t16 | t03 ⇒ t17 | t04 ⇒ t14 | t05 ⇒ t15 | t06 ⇒ t16 | t07 ⇒ t17 + | t08 ⇒ t1C | t09 ⇒ t1D | t0A ⇒ t1E | t0B ⇒ t1F | t0C ⇒ t1C | t0D ⇒ t1D | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t14 | t11 ⇒ t15 | t12 ⇒ t16 | t13 ⇒ t17 | t14 ⇒ t14 | t15 ⇒ t15 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1C | t19 ⇒ t1D | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t15 ⇒ match e2 with + [ t00 ⇒ t15 | t01 ⇒ t15 | t02 ⇒ t17 | t03 ⇒ t17 | t04 ⇒ t15 | t05 ⇒ t15 | t06 ⇒ t17 | t07 ⇒ t17 + | t08 ⇒ t1D | t09 ⇒ t1D | t0A ⇒ t1F | t0B ⇒ t1F | t0C ⇒ t1D | t0D ⇒ t1D | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t15 | t11 ⇒ t15 | t12 ⇒ t17 | t13 ⇒ t17 | t14 ⇒ t15 | t15 ⇒ t15 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1D | t19 ⇒ t1D | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t16 ⇒ match e2 with + [ t00 ⇒ t16 | t01 ⇒ t17 | t02 ⇒ t16 | t03 ⇒ t17 | t04 ⇒ t16 | t05 ⇒ t17 | t06 ⇒ t16 | t07 ⇒ t17 + | t08 ⇒ t1E | t09 ⇒ t1F | t0A ⇒ t1E | t0B ⇒ t1F | t0C ⇒ t1E | t0D ⇒ t1F | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t16 | t11 ⇒ t17 | t12 ⇒ t16 | t13 ⇒ t17 | t14 ⇒ t16 | t15 ⇒ t17 | t16 ⇒ t16 | t17 ⇒ t17 + | t18 ⇒ t1E | t19 ⇒ t1F | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t17 ⇒ match e2 with + [ t00 ⇒ t17 | t01 ⇒ t17 | t02 ⇒ t17 | t03 ⇒ t17 | t04 ⇒ t17 | t05 ⇒ t17 | t06 ⇒ t17 | t07 ⇒ t17 + | t08 ⇒ t1F | t09 ⇒ t1F | t0A ⇒ t1F | t0B ⇒ t1F | t0C ⇒ t1F | t0D ⇒ t1F | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t17 | t11 ⇒ t17 | t12 ⇒ t17 | t13 ⇒ t17 | t14 ⇒ t17 | t15 ⇒ t17 | t16 ⇒ t17 | t17 ⇒ t17 + | t18 ⇒ t1F | t19 ⇒ t1F | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t18 ⇒ match e2 with + [ t00 ⇒ t18 | t01 ⇒ t19 | t02 ⇒ t1A | t03 ⇒ t1B | t04 ⇒ t1C | t05 ⇒ t1D | t06 ⇒ t1E | t07 ⇒ t1F + | t08 ⇒ t18 | t09 ⇒ t19 | t0A ⇒ t1A | t0B ⇒ t1B | t0C ⇒ t1C | t0D ⇒ t1D | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t18 | t11 ⇒ t19 | t12 ⇒ t1A | t13 ⇒ t1B | t14 ⇒ t1C | t15 ⇒ t1D | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t18 | t19 ⇒ t19 | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t19 ⇒ match e2 with + [ t00 ⇒ t19 | t01 ⇒ t19 | t02 ⇒ t1B | t03 ⇒ t1B | t04 ⇒ t1D | t05 ⇒ t1D | t06 ⇒ t1F | t07 ⇒ t1F + | t08 ⇒ t19 | t09 ⇒ t19 | t0A ⇒ t1B | t0B ⇒ t1B | t0C ⇒ t1D | t0D ⇒ t1D | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t19 | t11 ⇒ t19 | t12 ⇒ t1B | t13 ⇒ t1B | t14 ⇒ t1D | t15 ⇒ t1D | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t19 | t19 ⇒ t19 | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t1A ⇒ match e2 with + [ t00 ⇒ t1A | t01 ⇒ t1B | t02 ⇒ t1A | t03 ⇒ t1B | t04 ⇒ t1E | t05 ⇒ t1F | t06 ⇒ t1E | t07 ⇒ t1F + | t08 ⇒ t1A | t09 ⇒ t1B | t0A ⇒ t1A | t0B ⇒ t1B | t0C ⇒ t1E | t0D ⇒ t1F | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t1A | t11 ⇒ t1B | t12 ⇒ t1A | t13 ⇒ t1B | t14 ⇒ t1E | t15 ⇒ t1F | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1A | t19 ⇒ t1B | t1A ⇒ t1A | t1B ⇒ t1B | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t1B ⇒ match e2 with + [ t00 ⇒ t1B | t01 ⇒ t1B | t02 ⇒ t1B | t03 ⇒ t1B | t04 ⇒ t1F | t05 ⇒ t1F | t06 ⇒ t1F | t07 ⇒ t1F + | t08 ⇒ t1B | t09 ⇒ t1B | t0A ⇒ t1B | t0B ⇒ t1B | t0C ⇒ t1F | t0D ⇒ t1F | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t1B | t11 ⇒ t1B | t12 ⇒ t1B | t13 ⇒ t1B | t14 ⇒ t1F | t15 ⇒ t1F | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1B | t19 ⇒ t1B | t1A ⇒ t1B | t1B ⇒ t1B | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + | t1C ⇒ match e2 with + [ t00 ⇒ t1C | t01 ⇒ t1D | t02 ⇒ t1E | t03 ⇒ t1F | t04 ⇒ t1C | t05 ⇒ t1D | t06 ⇒ t1E | t07 ⇒ t1F + | t08 ⇒ t1C | t09 ⇒ t1D | t0A ⇒ t1E | t0B ⇒ t1F | t0C ⇒ t1C | t0D ⇒ t1D | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t1C | t11 ⇒ t1D | t12 ⇒ t1E | t13 ⇒ t1F | t14 ⇒ t1C | t15 ⇒ t1D | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1C | t19 ⇒ t1D | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1C | t1D ⇒ t1D | t1E ⇒ t1E | t1F ⇒ t1F ] + | t1D ⇒ match e2 with + [ t00 ⇒ t1D | t01 ⇒ t1D | t02 ⇒ t1F | t03 ⇒ t1F | t04 ⇒ t1D | t05 ⇒ t1D | t06 ⇒ t1F | t07 ⇒ t1F + | t08 ⇒ t1D | t09 ⇒ t1D | t0A ⇒ t1F | t0B ⇒ t1F | t0C ⇒ t1D | t0D ⇒ t1D | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t1D | t11 ⇒ t1D | t12 ⇒ t1F | t13 ⇒ t1F | t14 ⇒ t1D | t15 ⇒ t1D | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1D | t19 ⇒ t1D | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1D | t1D ⇒ t1D | t1E ⇒ t1F | t1F ⇒ t1F ] + | t1E ⇒ match e2 with + [ t00 ⇒ t1E | t01 ⇒ t1F | t02 ⇒ t1E | t03 ⇒ t1F | t04 ⇒ t1E | t05 ⇒ t1F | t06 ⇒ t1E | t07 ⇒ t1F + | t08 ⇒ t1E | t09 ⇒ t1F | t0A ⇒ t1E | t0B ⇒ t1F | t0C ⇒ t1E | t0D ⇒ t1F | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t1E | t11 ⇒ t1F | t12 ⇒ t1E | t13 ⇒ t1F | t14 ⇒ t1E | t15 ⇒ t1F | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t1E | t19 ⇒ t1F | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1E | t1F ⇒ t1F ] + | t1F ⇒ match e2 with + [ t00 ⇒ t1F | t01 ⇒ t1F | t02 ⇒ t1F | t03 ⇒ t1F | t04 ⇒ t1F | t05 ⇒ t1F | t06 ⇒ t1F | t07 ⇒ t1F + | t08 ⇒ t1F | t09 ⇒ t1F | t0A ⇒ t1F | t0B ⇒ t1F | t0C ⇒ t1F | t0D ⇒ t1F | t0E ⇒ t1F | t0F ⇒ t1F + | t10 ⇒ t1F | t11 ⇒ t1F | t12 ⇒ t1F | t13 ⇒ t1F | t14 ⇒ t1F | t15 ⇒ t1F | t16 ⇒ t1F | t17 ⇒ t1F + | t18 ⇒ t1F | t19 ⇒ t1F | t1A ⇒ t1F | t1B ⇒ t1F | t1C ⇒ t1F | t1D ⇒ t1F | t1E ⇒ t1F | t1F ⇒ t1F ] + ]. + +(* operatore xor *) +ndefinition xor_bit ≝ +λe1,e2.match e1 with + [ t00 ⇒ match e2 with + [ t00 ⇒ 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 ] + | t01 ⇒ match e2 with + [ t00 ⇒ t01 | t01 ⇒ t00 | t02 ⇒ t03 | t03 ⇒ t02 | t04 ⇒ t05 | t05 ⇒ t04 | t06 ⇒ t07 | t07 ⇒ t06 + | t08 ⇒ t09 | t09 ⇒ t08 | t0A ⇒ t0B | t0B ⇒ t0A | t0C ⇒ t0D | t0D ⇒ t0C | t0E ⇒ t0F | t0F ⇒ t0E + | t10 ⇒ t11 | t11 ⇒ t10 | t12 ⇒ t13 | t13 ⇒ t12 | t14 ⇒ t15 | t15 ⇒ t14 | t16 ⇒ t17 | t17 ⇒ t16 + | t18 ⇒ t19 | t19 ⇒ t18 | t1A ⇒ t1B | t1B ⇒ t1A | t1C ⇒ t1D | t1D ⇒ t1C | t1E ⇒ t1F | t1F ⇒ t1E ] + | t02 ⇒ match e2 with + [ t00 ⇒ t02 | t01 ⇒ t03 | t02 ⇒ t00 | t03 ⇒ t01 | t04 ⇒ t06 | t05 ⇒ t07 | t06 ⇒ t04 | t07 ⇒ t05 + | t08 ⇒ t0A | t09 ⇒ t0B | t0A ⇒ t08 | t0B ⇒ t09 | t0C ⇒ t0E | t0D ⇒ t0F | t0E ⇒ t0C | t0F ⇒ t0D + | t10 ⇒ t12 | t11 ⇒ t13 | t12 ⇒ t10 | t13 ⇒ t11 | t14 ⇒ t16 | t15 ⇒ t17 | t16 ⇒ t14 | t17 ⇒ t15 + | t18 ⇒ t1A | t19 ⇒ t1B | t1A ⇒ t18 | t1B ⇒ t19 | t1C ⇒ t1E | t1D ⇒ t1F | t1E ⇒ t1C | t1F ⇒ t1D ] + | t03 ⇒ match e2 with + [ t00 ⇒ t03 | t01 ⇒ t02 | t02 ⇒ t01 | t03 ⇒ t00 | t04 ⇒ t07 | t05 ⇒ t06 | t06 ⇒ t05 | t07 ⇒ t04 + | t08 ⇒ t0B | t09 ⇒ t0A | t0A ⇒ t09 | t0B ⇒ t08 | t0C ⇒ t0F | t0D ⇒ t0E | t0E ⇒ t0D | t0F ⇒ t0C + | t10 ⇒ t13 | t11 ⇒ t12 | t12 ⇒ t11 | t13 ⇒ t10 | t14 ⇒ t17 | t15 ⇒ t16 | t16 ⇒ t15 | t17 ⇒ t14 + | t18 ⇒ t1B | t19 ⇒ t1A | t1A ⇒ t19 | t1B ⇒ t18 | t1C ⇒ t1F | t1D ⇒ t1E | t1E ⇒ t1D | t1F ⇒ t1C ] + | t04 ⇒ match e2 with + [ t00 ⇒ t04 | t01 ⇒ t05 | t02 ⇒ t06 | t03 ⇒ t07 | t04 ⇒ t00 | t05 ⇒ t01 | t06 ⇒ t02 | t07 ⇒ t03 + | t08 ⇒ t0C | t09 ⇒ t0D | t0A ⇒ t0E | t0B ⇒ t0F | t0C ⇒ t08 | t0D ⇒ t09 | t0E ⇒ t0A | t0F ⇒ t0B + | t10 ⇒ t14 | t11 ⇒ t15 | t12 ⇒ t16 | t13 ⇒ t17 | t14 ⇒ t10 | t15 ⇒ t11 | t16 ⇒ t12 | t17 ⇒ t13 + | t18 ⇒ t1C | t19 ⇒ t1D | t1A ⇒ t1E | t1B ⇒ t1F | t1C ⇒ t18 | t1D ⇒ t19 | t1E ⇒ t1A | t1F ⇒ t1B ] + | t05 ⇒ match e2 with + [ t00 ⇒ t05 | t01 ⇒ t04 | t02 ⇒ t07 | t03 ⇒ t06 | t04 ⇒ t01 | t05 ⇒ t00 | t06 ⇒ t03 | t07 ⇒ t02 + | t08 ⇒ t0D | t09 ⇒ t0C | t0A ⇒ t0F | t0B ⇒ t0E | t0C ⇒ t09 | t0D ⇒ t08 | t0E ⇒ t0B | t0F ⇒ t0A + | t10 ⇒ t15 | t11 ⇒ t14 | t12 ⇒ t17 | t13 ⇒ t16 | t14 ⇒ t11 | t15 ⇒ t10 | t16 ⇒ t13 | t17 ⇒ t12 + | t18 ⇒ t1D | t19 ⇒ t1C | t1A ⇒ t1F | t1B ⇒ t1E | t1C ⇒ t19 | t1D ⇒ t18 | t1E ⇒ t1B | t1F ⇒ t1A ] + | t06 ⇒ match e2 with + [ t00 ⇒ t06 | t01 ⇒ t07 | t02 ⇒ t04 | t03 ⇒ t05 | t04 ⇒ t02 | t05 ⇒ t03 | t06 ⇒ t00 | t07 ⇒ t01 + | t08 ⇒ t0E | t09 ⇒ t0F | t0A ⇒ t0C | t0B ⇒ t0D | t0C ⇒ t0A | t0D ⇒ t0B | t0E ⇒ t08 | t0F ⇒ t09 + | t10 ⇒ t16 | t11 ⇒ t17 | t12 ⇒ t14 | t13 ⇒ t15 | t14 ⇒ t12 | t15 ⇒ t13 | t16 ⇒ t10 | t17 ⇒ t11 + | t18 ⇒ t1E | t19 ⇒ t1F | t1A ⇒ t1C | t1B ⇒ t1D | t1C ⇒ t1A | t1D ⇒ t1B | t1E ⇒ t18 | t1F ⇒ t19 ] + | t07 ⇒ match e2 with + [ t00 ⇒ t07 | t01 ⇒ t06 | t02 ⇒ t05 | t03 ⇒ t04 | t04 ⇒ t03 | t05 ⇒ t02 | t06 ⇒ t01 | t07 ⇒ t00 + | t08 ⇒ t0F | t09 ⇒ t0E | t0A ⇒ t0D | t0B ⇒ t0C | t0C ⇒ t0B | t0D ⇒ t0A | t0E ⇒ t09 | t0F ⇒ t08 + | t10 ⇒ t17 | t11 ⇒ t16 | t12 ⇒ t15 | t13 ⇒ t14 | t14 ⇒ t13 | t15 ⇒ t12 | t16 ⇒ t11 | t17 ⇒ t10 + | t18 ⇒ t1F | t19 ⇒ t1E | t1A ⇒ t1D | t1B ⇒ t1C | t1C ⇒ t1B | t1D ⇒ t1A | t1E ⇒ t19 | t1F ⇒ t18 ] + | t08 ⇒ match e2 with + [ t00 ⇒ t08 | t01 ⇒ t09 | t02 ⇒ t0A | t03 ⇒ t0B | t04 ⇒ t0C | t05 ⇒ t0D | t06 ⇒ t0E | t07 ⇒ t0F + | t08 ⇒ t00 | t09 ⇒ t01 | t0A ⇒ t02 | t0B ⇒ t03 | t0C ⇒ t04 | t0D ⇒ t05 | t0E ⇒ t06 | t0F ⇒ t07 + | t10 ⇒ t18 | t11 ⇒ t19 | t12 ⇒ t1A | t13 ⇒ t1B | t14 ⇒ t1C | t15 ⇒ t1D | t16 ⇒ t1E | t17 ⇒ t1F + | t18 ⇒ t10 | t19 ⇒ t11 | t1A ⇒ t12 | t1B ⇒ t13 | t1C ⇒ t14 | t1D ⇒ t15 | t1E ⇒ t16 | t1F ⇒ t17 ] + | t09 ⇒ match e2 with + [ t00 ⇒ t09 | t01 ⇒ t08 | t02 ⇒ t0B | t03 ⇒ t0A | t04 ⇒ t0D | t05 ⇒ t0C | t06 ⇒ t0F | t07 ⇒ t0E + | t08 ⇒ t01 | t09 ⇒ t00 | t0A ⇒ t03 | t0B ⇒ t02 | t0C ⇒ t05 | t0D ⇒ t04 | t0E ⇒ t07 | t0F ⇒ t06 + | t10 ⇒ t19 | t11 ⇒ t18 | t12 ⇒ t1B | t13 ⇒ t1A | t14 ⇒ t1D | t15 ⇒ t1C | t16 ⇒ t1F | t17 ⇒ t1E + | t18 ⇒ t11 | t19 ⇒ t10 | t1A ⇒ t13 | t1B ⇒ t12 | t1C ⇒ t15 | t1D ⇒ t14 | t1E ⇒ t17 | t1F ⇒ t16 ] + | t0A ⇒ match e2 with + [ t00 ⇒ t0A | t01 ⇒ t0B | t02 ⇒ t08 | t03 ⇒ t09 | t04 ⇒ t0E | t05 ⇒ t0F | t06 ⇒ t0C | t07 ⇒ t0D + | t08 ⇒ t02 | t09 ⇒ t03 | t0A ⇒ t00 | t0B ⇒ t01 | t0C ⇒ t06 | t0D ⇒ t07 | t0E ⇒ t04 | t0F ⇒ t05 + | t10 ⇒ t1A | t11 ⇒ t1B | t12 ⇒ t18 | t13 ⇒ t19 | t14 ⇒ t1E | t15 ⇒ t1F | t16 ⇒ t1C | t17 ⇒ t1D + | t18 ⇒ t12 | t19 ⇒ t13 | t1A ⇒ t10 | t1B ⇒ t11 | t1C ⇒ t16 | t1D ⇒ t17 | t1E ⇒ t14 | t1F ⇒ t15 ] + | t0B ⇒ match e2 with + [ t00 ⇒ t0B | t01 ⇒ t0A | t02 ⇒ t09 | t03 ⇒ t08 | t04 ⇒ t0F | t05 ⇒ t0E | t06 ⇒ t0D | t07 ⇒ t0C + | t08 ⇒ t03 | t09 ⇒ t02 | t0A ⇒ t01 | t0B ⇒ t00 | t0C ⇒ t07 | t0D ⇒ t06 | t0E ⇒ t05 | t0F ⇒ t04 + | t10 ⇒ t1B | t11 ⇒ t1A | t12 ⇒ t19 | t13 ⇒ t18 | t14 ⇒ t1F | t15 ⇒ t1E | t16 ⇒ t1D | t17 ⇒ t1C + | t18 ⇒ t13 | t19 ⇒ t12 | t1A ⇒ t11 | t1B ⇒ t10 | t1C ⇒ t17 | t1D ⇒ t16 | t1E ⇒ t15 | t1F ⇒ t14 ] + | t0C ⇒ match e2 with + [ t00 ⇒ t0C | t01 ⇒ t0D | t02 ⇒ t0E | t03 ⇒ t0F | t04 ⇒ t08 | t05 ⇒ t09 | t06 ⇒ t0A | t07 ⇒ t0B + | t08 ⇒ t04 | t09 ⇒ t05 | t0A ⇒ t06 | t0B ⇒ t07 | t0C ⇒ t00 | t0D ⇒ t01 | t0E ⇒ t02 | t0F ⇒ t03 + | t10 ⇒ t1C | t11 ⇒ t1D | t12 ⇒ t1E | t13 ⇒ t1F | t14 ⇒ t18 | t15 ⇒ t19 | t16 ⇒ t1A | t17 ⇒ t1B + | t18 ⇒ t14 | t19 ⇒ t15 | t1A ⇒ t16 | t1B ⇒ t17 | t1C ⇒ t10 | t1D ⇒ t11 | t1E ⇒ t12 | t1F ⇒ t13 ] + | t0D ⇒ match e2 with + [ t00 ⇒ t0D | t01 ⇒ t0C | t02 ⇒ t0F | t03 ⇒ t0E | t04 ⇒ t09 | t05 ⇒ t08 | t06 ⇒ t0B | t07 ⇒ t0A + | t08 ⇒ t05 | t09 ⇒ t04 | t0A ⇒ t07 | t0B ⇒ t06 | t0C ⇒ t01 | t0D ⇒ t00 | t0E ⇒ t03 | t0F ⇒ t02 + | t10 ⇒ t1D | t11 ⇒ t1C | t12 ⇒ t1F | t13 ⇒ t1E | t14 ⇒ t19 | t15 ⇒ t18 | t16 ⇒ t1B | t17 ⇒ t1A + | t18 ⇒ t15 | t19 ⇒ t14 | t1A ⇒ t17 | t1B ⇒ t16 | t1C ⇒ t11 | t1D ⇒ t10 | t1E ⇒ t13 | t1F ⇒ t12 ] + | t0E ⇒ match e2 with + [ t00 ⇒ t0E | t01 ⇒ t0F | t02 ⇒ t0C | t03 ⇒ t0D | t04 ⇒ t0A | t05 ⇒ t0B | t06 ⇒ t08 | t07 ⇒ t09 + | t08 ⇒ t06 | t09 ⇒ t07 | t0A ⇒ t04 | t0B ⇒ t05 | t0C ⇒ t02 | t0D ⇒ t03 | t0E ⇒ t00 | t0F ⇒ t01 + | t10 ⇒ t1E | t11 ⇒ t1F | t12 ⇒ t1C | t13 ⇒ t1D | t14 ⇒ t1A | t15 ⇒ t1B | t16 ⇒ t18 | t17 ⇒ t19 + | t18 ⇒ t16 | t19 ⇒ t17 | t1A ⇒ t14 | t1B ⇒ t15 | t1C ⇒ t12 | t1D ⇒ t13 | t1E ⇒ t10 | t1F ⇒ t11 ] + | t0F ⇒ match e2 with + [ t00 ⇒ t0F | t01 ⇒ t0E | t02 ⇒ t0D | t03 ⇒ t0C | t04 ⇒ t0B | t05 ⇒ t0A | t06 ⇒ t09 | t07 ⇒ t08 + | t08 ⇒ t07 | t09 ⇒ t06 | t0A ⇒ t05 | t0B ⇒ t04 | t0C ⇒ t03 | t0D ⇒ t02 | t0E ⇒ t01 | t0F ⇒ t00 + | t10 ⇒ t1F | t11 ⇒ t1E | t12 ⇒ t1D | t13 ⇒ t1C | t14 ⇒ t1B | t15 ⇒ t1A | t16 ⇒ t19 | t17 ⇒ t18 + | t18 ⇒ t17 | t19 ⇒ t16 | t1A ⇒ t15 | t1B ⇒ t14 | t1C ⇒ t13 | t1D ⇒ t12 | t1E ⇒ t11 | t1F ⇒ t10 ] + | t10 ⇒ match e2 with + [ t00 ⇒ t10 | t01 ⇒ t11 | t02 ⇒ t12 | t03 ⇒ t13 | t04 ⇒ t14 | t05 ⇒ t15 | t06 ⇒ t16 | t07 ⇒ t17 + | t08 ⇒ t18 | t09 ⇒ t19 | t0A ⇒ t1A | t0B ⇒ t1B | t0C ⇒ t1C | t0D ⇒ t1D | t0E ⇒ t1E | t0F ⇒ t1F + | t10 ⇒ t00 | t11 ⇒ t01 | t12 ⇒ t02 | t13 ⇒ t03 | t14 ⇒ t04 | t15 ⇒ t05 | t16 ⇒ t06 | t17 ⇒ t07 + | t18 ⇒ t08 | t19 ⇒ t09 | t1A ⇒ t0A | t1B ⇒ t0B | t1C ⇒ t0C | t1D ⇒ t0D | t1E ⇒ t0E | t1F ⇒ t0F ] + | t11 ⇒ match e2 with + [ t00 ⇒ t11 | t01 ⇒ t10 | t02 ⇒ t13 | t03 ⇒ t12 | t04 ⇒ t15 | t05 ⇒ t14 | t06 ⇒ t17 | t07 ⇒ t16 + | t08 ⇒ t19 | t09 ⇒ t18 | t0A ⇒ t1B | t0B ⇒ t1A | t0C ⇒ t1D | t0D ⇒ t1C | t0E ⇒ t1F | t0F ⇒ t1E + | t10 ⇒ t01 | t11 ⇒ t00 | t12 ⇒ t03 | t13 ⇒ t02 | t14 ⇒ t05 | t15 ⇒ t04 | t16 ⇒ t07 | t17 ⇒ t06 + | t18 ⇒ t09 | t19 ⇒ t08 | t1A ⇒ t0B | t1B ⇒ t0A | t1C ⇒ t0D | t1D ⇒ t0C | t1E ⇒ t0F | t1F ⇒ t0E ] + | t12 ⇒ match e2 with + [ t00 ⇒ t12 | t01 ⇒ t13 | t02 ⇒ t10 | t03 ⇒ t11 | t04 ⇒ t16 | t05 ⇒ t17 | t06 ⇒ t14 | t07 ⇒ t15 + | t08 ⇒ t1A | t09 ⇒ t1B | t0A ⇒ t18 | t0B ⇒ t19 | t0C ⇒ t1E | t0D ⇒ t1F | t0E ⇒ t1C | t0F ⇒ t1D + | t10 ⇒ t02 | t11 ⇒ t03 | t12 ⇒ t00 | t13 ⇒ t01 | t14 ⇒ t06 | t15 ⇒ t07 | t16 ⇒ t04 | t17 ⇒ t05 + | t18 ⇒ t0A | t19 ⇒ t0B | t1A ⇒ t08 | t1B ⇒ t09 | t1C ⇒ t0E | t1D ⇒ t0F | t1E ⇒ t0C | t1F ⇒ t0D ] + | t13 ⇒ match e2 with + [ t00 ⇒ t13 | t01 ⇒ t12 | t02 ⇒ t11 | t03 ⇒ t10 | t04 ⇒ t17 | t05 ⇒ t16 | t06 ⇒ t15 | t07 ⇒ t14 + | t08 ⇒ t1B | t09 ⇒ t1A | t0A ⇒ t19 | t0B ⇒ t18 | t0C ⇒ t1F | t0D ⇒ t1E | t0E ⇒ t1D | t0F ⇒ t1C + | t10 ⇒ t03 | t11 ⇒ t02 | t12 ⇒ t01 | t13 ⇒ t00 | t14 ⇒ t07 | t15 ⇒ t06 | t16 ⇒ t05 | t17 ⇒ t04 + | t18 ⇒ t0B | t19 ⇒ t0A | t1A ⇒ t09 | t1B ⇒ t08 | t1C ⇒ t0F | t1D ⇒ t0E | t1E ⇒ t0D | t1F ⇒ t0C ] + | t14 ⇒ match e2 with + [ t00 ⇒ t14 | t01 ⇒ t15 | t02 ⇒ t16 | t03 ⇒ t17 | t04 ⇒ t10 | t05 ⇒ t11 | t06 ⇒ t12 | t07 ⇒ t13 + | t08 ⇒ t1C | t09 ⇒ t1D | t0A ⇒ t1E | t0B ⇒ t1F | t0C ⇒ t18 | t0D ⇒ t19 | t0E ⇒ t1A | t0F ⇒ t1B + | t10 ⇒ t04 | t11 ⇒ t05 | t12 ⇒ t06 | t13 ⇒ t07 | t14 ⇒ t00 | t15 ⇒ t01 | t16 ⇒ t02 | t17 ⇒ t03 + | t18 ⇒ t0C | t19 ⇒ t0D | t1A ⇒ t0E | t1B ⇒ t0F | t1C ⇒ t08 | t1D ⇒ t09 | t1E ⇒ t0A | t1F ⇒ t0B ] + | t15 ⇒ match e2 with + [ t00 ⇒ t15 | t01 ⇒ t14 | t02 ⇒ t17 | t03 ⇒ t16 | t04 ⇒ t11 | t05 ⇒ t10 | t06 ⇒ t13 | t07 ⇒ t12 + | t08 ⇒ t1D | t09 ⇒ t1C | t0A ⇒ t1F | t0B ⇒ t1E | t0C ⇒ t19 | t0D ⇒ t18 | t0E ⇒ t1B | t0F ⇒ t1A + | t10 ⇒ t05 | t11 ⇒ t04 | t12 ⇒ t07 | t13 ⇒ t06 | t14 ⇒ t01 | t15 ⇒ t00 | t16 ⇒ t03 | t17 ⇒ t02 + | t18 ⇒ t0D | t19 ⇒ t0C | t1A ⇒ t0F | t1B ⇒ t0E | t1C ⇒ t09 | t1D ⇒ t08 | t1E ⇒ t0B | t1F ⇒ t0A ] + | t16 ⇒ match e2 with + [ t00 ⇒ t16 | t01 ⇒ t17 | t02 ⇒ t14 | t03 ⇒ t15 | t04 ⇒ t12 | t05 ⇒ t13 | t06 ⇒ t10 | t07 ⇒ t11 + | t08 ⇒ t1E | t09 ⇒ t1F | t0A ⇒ t1C | t0B ⇒ t1D | t0C ⇒ t1A | t0D ⇒ t1B | t0E ⇒ t18 | t0F ⇒ t19 + | t10 ⇒ t06 | t11 ⇒ t07 | t12 ⇒ t04 | t13 ⇒ t05 | t14 ⇒ t02 | t15 ⇒ t03 | t16 ⇒ t00 | t17 ⇒ t01 + | t18 ⇒ t0E | t19 ⇒ t0F | t1A ⇒ t0C | t1B ⇒ t0D | t1C ⇒ t0A | t1D ⇒ t0B | t1E ⇒ t08 | t1F ⇒ t09 ] + | t17 ⇒ match e2 with + [ t00 ⇒ t17 | t01 ⇒ t16 | t02 ⇒ t15 | t03 ⇒ t14 | t04 ⇒ t13 | t05 ⇒ t12 | t06 ⇒ t11 | t07 ⇒ t10 + | t08 ⇒ t1F | t09 ⇒ t1E | t0A ⇒ t1D | t0B ⇒ t1C | t0C ⇒ t1B | t0D ⇒ t1A | t0E ⇒ t19 | t0F ⇒ t18 + | t10 ⇒ t07 | t11 ⇒ t06 | t12 ⇒ t05 | t13 ⇒ t04 | t14 ⇒ t03 | t15 ⇒ t02 | t16 ⇒ t01 | t17 ⇒ t00 + | t18 ⇒ t0F | t19 ⇒ t0E | t1A ⇒ t0D | t1B ⇒ t0C | t1C ⇒ t0B | t1D ⇒ t0A | t1E ⇒ t09 | t1F ⇒ t08 ] + | t18 ⇒ match e2 with + [ t00 ⇒ t18 | t01 ⇒ t19 | t02 ⇒ t1A | t03 ⇒ t1B | t04 ⇒ t1C | t05 ⇒ t1D | t06 ⇒ t1E | t07 ⇒ t1F + | t08 ⇒ t10 | t09 ⇒ t11 | t0A ⇒ t12 | t0B ⇒ t13 | t0C ⇒ t14 | t0D ⇒ t15 | t0E ⇒ t16 | t0F ⇒ t17 + | t10 ⇒ t08 | t11 ⇒ t09 | t12 ⇒ t0A | t13 ⇒ t0B | t14 ⇒ t0C | t15 ⇒ t0D | t16 ⇒ t0E | t17 ⇒ t0F + | t18 ⇒ t00 | t19 ⇒ t01 | t1A ⇒ t02 | t1B ⇒ t03 | t1C ⇒ t04 | t1D ⇒ t05 | t1E ⇒ t06 | t1F ⇒ t07 ] + | t19 ⇒ match e2 with + [ t00 ⇒ t19 | t01 ⇒ t18 | t02 ⇒ t1B | t03 ⇒ t1A | t04 ⇒ t1D | t05 ⇒ t1C | t06 ⇒ t1F | t07 ⇒ t1E + | t08 ⇒ t11 | t09 ⇒ t10 | t0A ⇒ t13 | t0B ⇒ t12 | t0C ⇒ t15 | t0D ⇒ t14 | t0E ⇒ t17 | t0F ⇒ t16 + | t10 ⇒ t09 | t11 ⇒ t08 | t12 ⇒ t0B | t13 ⇒ t0A | t14 ⇒ t0D | t15 ⇒ t0C | t16 ⇒ t0F | t17 ⇒ t0E + | t18 ⇒ t01 | t19 ⇒ t00 | t1A ⇒ t03 | t1B ⇒ t02 | t1C ⇒ t05 | t1D ⇒ t04 | t1E ⇒ t07 | t1F ⇒ t06 ] + | t1A ⇒ match e2 with + [ t00 ⇒ t1A | t01 ⇒ t1B | t02 ⇒ t18 | t03 ⇒ t19 | t04 ⇒ t1E | t05 ⇒ t1F | t06 ⇒ t1C | t07 ⇒ t1D + | t08 ⇒ t12 | t09 ⇒ t13 | t0A ⇒ t10 | t0B ⇒ t11 | t0C ⇒ t16 | t0D ⇒ t17 | t0E ⇒ t14 | t0F ⇒ t15 + | t10 ⇒ t0A | t11 ⇒ t0B | t12 ⇒ t08 | t13 ⇒ t09 | t14 ⇒ t0E | t15 ⇒ t0F | t16 ⇒ t0C | t17 ⇒ t0D + | t18 ⇒ t02 | t19 ⇒ t03 | t1A ⇒ t00 | t1B ⇒ t01 | t1C ⇒ t06 | t1D ⇒ t07 | t1E ⇒ t04 | t1F ⇒ t05 ] + | t1B ⇒ match e2 with + [ t00 ⇒ t1B | t01 ⇒ t1A | t02 ⇒ t19 | t03 ⇒ t18 | t04 ⇒ t1F | t05 ⇒ t1E | t06 ⇒ t1D | t07 ⇒ t1C + | t08 ⇒ t13 | t09 ⇒ t12 | t0A ⇒ t11 | t0B ⇒ t10 | t0C ⇒ t17 | t0D ⇒ t16 | t0E ⇒ t15 | t0F ⇒ t14 + | t10 ⇒ t0B | t11 ⇒ t0A | t12 ⇒ t09 | t13 ⇒ t08 | t14 ⇒ t0F | t15 ⇒ t0E | t16 ⇒ t0D | t17 ⇒ t0C + | t18 ⇒ t03 | t19 ⇒ t02 | t1A ⇒ t01 | t1B ⇒ t00 | t1C ⇒ t07 | t1D ⇒ t06 | t1E ⇒ t05 | t1F ⇒ t04 ] + | t1C ⇒ match e2 with + [ t00 ⇒ t1C | t01 ⇒ t1D | t02 ⇒ t1E | t03 ⇒ t1F | t04 ⇒ t18 | t05 ⇒ t19 | t06 ⇒ t1A | t07 ⇒ t1B + | t08 ⇒ t14 | t09 ⇒ t15 | t0A ⇒ t16 | t0B ⇒ t17 | t0C ⇒ t10 | t0D ⇒ t11 | t0E ⇒ t12 | t0F ⇒ t13 + | t10 ⇒ t0C | t11 ⇒ t0D | t12 ⇒ t0E | t13 ⇒ t0F | t14 ⇒ t08 | t15 ⇒ t09 | t16 ⇒ t0A | t17 ⇒ t0B + | t18 ⇒ t04 | t19 ⇒ t05 | t1A ⇒ t06 | t1B ⇒ t07 | t1C ⇒ t00 | t1D ⇒ t01 | t1E ⇒ t02 | t1F ⇒ t03 ] + | t1D ⇒ match e2 with + [ t00 ⇒ t1D | t01 ⇒ t1C | t02 ⇒ t1F | t03 ⇒ t1E | t04 ⇒ t19 | t05 ⇒ t18 | t06 ⇒ t1B | t07 ⇒ t1A + | t08 ⇒ t15 | t09 ⇒ t14 | t0A ⇒ t17 | t0B ⇒ t16 | t0C ⇒ t11 | t0D ⇒ t10 | t0E ⇒ t13 | t0F ⇒ t12 + | t10 ⇒ t0D | t11 ⇒ t0C | t12 ⇒ t0F | t13 ⇒ t0E | t14 ⇒ t09 | t15 ⇒ t08 | t16 ⇒ t0B | t17 ⇒ t0A + | t18 ⇒ t05 | t19 ⇒ t04 | t1A ⇒ t07 | t1B ⇒ t06 | t1C ⇒ t01 | t1D ⇒ t00 | t1E ⇒ t03 | t1F ⇒ t02 ] + | t1E ⇒ match e2 with + [ t00 ⇒ t1E | t01 ⇒ t1F | t02 ⇒ t1C | t03 ⇒ t1D | t04 ⇒ t1A | t05 ⇒ t1B | t06 ⇒ t18 | t07 ⇒ t19 + | t08 ⇒ t16 | t09 ⇒ t17 | t0A ⇒ t14 | t0B ⇒ t15 | t0C ⇒ t12 | t0D ⇒ t13 | t0E ⇒ t10 | t0F ⇒ t11 + | t10 ⇒ t0E | t11 ⇒ t0F | t12 ⇒ t0C | t13 ⇒ t0D | t14 ⇒ t0A | t15 ⇒ t0B | t16 ⇒ t08 | t17 ⇒ t09 + | t18 ⇒ t06 | t19 ⇒ t07 | t1A ⇒ t04 | t1B ⇒ t05 | t1C ⇒ t02 | t1D ⇒ t03 | t1E ⇒ t00 | t1F ⇒ t01 ] + | t1F ⇒ match e2 with + [ t00 ⇒ t1F | t01 ⇒ t1E | t02 ⇒ t1D | t03 ⇒ t1C | t04 ⇒ t1B | t05 ⇒ t1A | t06 ⇒ t19 | t07 ⇒ t18 + | t08 ⇒ t17 | t09 ⇒ t16 | t0A ⇒ t15 | t0B ⇒ t14 | t0C ⇒ t13 | t0D ⇒ t12 | t0E ⇒ t11 | t0F ⇒ t10 + | t10 ⇒ t0F | t11 ⇒ t0E | t12 ⇒ t0D | t13 ⇒ t0C | t14 ⇒ t0B | t15 ⇒ t0A | t16 ⇒ t09 | t17 ⇒ t08 + | t18 ⇒ t07 | t19 ⇒ t06 | t1A ⇒ t05 | t1B ⇒ t04 | t1C ⇒ t03 | t1D ⇒ t02 | t1E ⇒ t01 | t1F ⇒ t00 ] + ]. + +(* operatore predecessore *) +ndefinition pred_bit ≝ +λn.match n with + [ t00 ⇒ t1F | t01 ⇒ t00 | t02 ⇒ t01 | t03 ⇒ t02 | t04 ⇒ t03 | t05 ⇒ t04 | t06 ⇒ t05 | t07 ⇒ t06 + | t08 ⇒ t07 | t09 ⇒ t08 | t0A ⇒ t09 | t0B ⇒ t0A | t0C ⇒ t0B | t0D ⇒ t0C | t0E ⇒ t0D | t0F ⇒ t0E + | t10 ⇒ t0F | t11 ⇒ t10 | t12 ⇒ t11 | t13 ⇒ t12 | t14 ⇒ t13 | t15 ⇒ t14 | t16 ⇒ t15 | t17 ⇒ t16 + | t18 ⇒ t17 | t19 ⇒ t18 | t1A ⇒ t19 | t1B ⇒ t1A | t1C ⇒ t1B | t1D ⇒ t1C | t1E ⇒ t1D | t1F ⇒ t0E + ]. + (* operatore successore *) ndefinition succ_bit ≝ λn.match n with diff --git a/helm/software/matita/contribs/ng_assembly2/num/bool.ma b/helm/software/matita/contribs/ng_assembly2/num/bool.ma index 8092713f2..8d97483a1 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/bool.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/bool.ma @@ -31,7 +31,6 @@ ninductive bool : Type ≝ | false : bool. (* operatori booleani *) - ndefinition eq_bool ≝ λb1,b2:bool.match b1 with [ true ⇒ match b2 with [ true ⇒ true | false ⇒ false ] @@ -74,5 +73,8 @@ 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). +(* iteratore sugli esadecimali *) +ndefinition forall_bool ≝ λP.P true ⊗ P false. + ndefinition boolRelation : Type → Type ≝ λA:Type.A → A → bool. diff --git a/helm/software/matita/contribs/ng_assembly2/num/bool_lemmas.ma b/helm/software/matita/contribs/ng_assembly2/num/bool_lemmas.ma index 660dd7e67..65afc3527 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/bool_lemmas.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/bool_lemmas.ma @@ -21,6 +21,7 @@ (* ********************************************************************** *) include "num/bool.ma". +include "common/comp.ma". (* ******** *) (* BOOLEANI *) @@ -320,3 +321,19 @@ nlemma orb_false_false_r : ∀b1,b2:bool.(b1 ⊕ b2) = false → b2 = false. ##| ##*: #H; ndestruct (*napply (bool_destruct … H)*) ##] nqed. + +nlemma bool_is_comparable : comparable. + @ bool + ##[ napply false + ##| napply forall_bool + ##| napply eq_bool + ##| napply eqbool_to_eq + ##| napply eq_to_eqbool + ##| napply neqbool_to_neq + ##| napply neq_to_neqbool + ##| napply decidable_bool + ##| napply symmetric_eqbool + ##] +nqed. + +unification hint 0 ≔ ⊢ carr bool_is_comparable ≡ bool. diff --git a/helm/software/matita/contribs/ng_assembly2/num/byte8.ma b/helm/software/matita/contribs/ng_assembly2/num/byte8.ma index c45d71c6e..9e92c2952 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/byte8.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/byte8.ma @@ -35,9 +35,12 @@ ndefinition mk_byte8 ≝ λe1,e2.mk_comp_num exadecim e1 e2. notation "〈x,y〉" non associative with precedence 80 for @{ mk_comp_num exadecim $x $y }. +ndefinition byte8_is_comparable ≝ cn_is_comparable exadecim_is_comparable. ndefinition byte8_is_comparable_ext ≝ cn_is_comparable_ext exadecim_is_comparable_ext. unification hint 0 ≔ ⊢ carr (comp_base byte8_is_comparable_ext) ≡ comp_num exadecim. unification hint 0 ≔ ⊢ carr (comp_base byte8_is_comparable_ext) ≡ byte8. +unification hint 0 ≔ ⊢ carr byte8_is_comparable ≡ comp_num exadecim. +unification hint 0 ≔ ⊢ carr byte8_is_comparable ≡ byte8. (* operatore estensione unsigned *) ndefinition extu_b8 ≝ λe2.〈zeroc ?,e2〉. diff --git a/helm/software/matita/contribs/ng_assembly2/num/comp_num.ma b/helm/software/matita/contribs/ng_assembly2/num/comp_num.ma index a062a5624..e9c15dde6 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/comp_num.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/comp_num.ma @@ -216,7 +216,7 @@ nlemma cn_is_comparable : comparable → comparable. nqed. nlemma cn_is_comparable_ext : comparable_ext → comparable_ext. - #T; nelim T; #c; + #T; nelim T; #c; #ltc; #lec; #gtc; #gec; #andc; #orc; #xorc; #getMSBc; #setMSBc; #clrMSBc; #getLSBc; #setLSBc; #clrLSBc; #rcrc; #shrc; #rorc; #rclc; #shlc; #rolc; #notc; @@ -337,12 +337,6 @@ nlemma cn_is_comparable_ext : comparable_ext → comparable_ext. ##] nqed. -unification hint 0 ≔ S: comparable; - T ≟ (carr S), - X ≟ (cn_is_comparable S) - (*********************************************) ⊢ - carr X ≡ comp_num T. - ndefinition zeroc ≝ λx:comparable_ext.zeroc (comp_base x). ndefinition forallc ≝ λx:comparable_ext.forallc (comp_base x). ndefinition eqc ≝ λx:comparable_ext.eqc (comp_base x). @@ -352,3 +346,10 @@ ndefinition neqc_to_neq ≝ λx:comparable_ext.neqc_to_neq (comp_base x). ndefinition neq_to_neqc ≝ λx:comparable_ext.neq_to_neqc (comp_base x). ndefinition decidable_c ≝ λx:comparable_ext.decidable_c (comp_base x). ndefinition symmetric_eqc ≝ λx:comparable_ext.symmetric_eqc (comp_base x). + + +unification hint 0 ≔ S: comparable; + T ≟ (carr S), + X ≟ (cn_is_comparable S) + (*********************************************) ⊢ + carr X ≡ comp_num T. diff --git a/helm/software/matita/contribs/ng_assembly2/num/oct.ma b/helm/software/matita/contribs/ng_assembly2/num/oct.ma index a8199dd53..646227d93 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/oct.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/oct.ma @@ -142,6 +142,11 @@ ndefinition xor_oct ≝ | o4 ⇒ o3 | o5 ⇒ o2 | o6 ⇒ o1 | o7 ⇒ o0 ] ]. +(* operatore predecessore *) +ndefinition pred_oct ≝ +λn.match n with + [ o0 ⇒ o7 | o1 ⇒ o0 | o2 ⇒ o1 | o3 ⇒ o2 | o4 ⇒ o3 | o5 ⇒ o4 | o6 ⇒ o5 | o7 ⇒ o6 ]. + (* operatore successore *) ndefinition succ_oct ≝ λn.match n with diff --git a/helm/software/matita/contribs/ng_assembly2/num/word16.ma b/helm/software/matita/contribs/ng_assembly2/num/word16.ma index c0d331a5a..9d8c413c4 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/word16.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/word16.ma @@ -34,10 +34,14 @@ ndefinition mk_word16 ≝ λb1,b2.mk_comp_num byte8 b1 b2. notation "〈x:y〉" non associative with precedence 80 for @{ mk_comp_num byte8 $x $y }. +ndefinition word16_is_comparable ≝ cn_is_comparable byte8_is_comparable. ndefinition word16_is_comparable_ext ≝ cn_is_comparable_ext byte8_is_comparable_ext. unification hint 0 ≔ ⊢ carr (comp_base word16_is_comparable_ext) ≡ comp_num (comp_num exadecim). unification hint 0 ≔ ⊢ carr (comp_base word16_is_comparable_ext) ≡ comp_num byte8. unification hint 0 ≔ ⊢ carr (comp_base word16_is_comparable_ext) ≡ word16. +unification hint 0 ≔ ⊢ carr word16_is_comparable ≡ comp_num (comp_num exadecim). +unification hint 0 ≔ ⊢ carr word16_is_comparable ≡ comp_num byte8. +unification hint 0 ≔ ⊢ carr word16_is_comparable ≡ word16. (* operatore estensione unsigned *) ndefinition extu_w16 ≝ λb2.〈zeroc ?:b2〉. diff --git a/helm/software/matita/contribs/ng_assembly2/num/word32.ma b/helm/software/matita/contribs/ng_assembly2/num/word32.ma index 4fbbe96fc..7cc9461b2 100755 --- a/helm/software/matita/contribs/ng_assembly2/num/word32.ma +++ b/helm/software/matita/contribs/ng_assembly2/num/word32.ma @@ -33,11 +33,16 @@ ndefinition mk_word32 ≝ λw1,w2.mk_comp_num word16 w1 w2. notation "〈x.y〉" non associative with precedence 80 for @{ mk_comp_num word16 $x $y }. +ndefinition word32_is_comparable ≝ cn_is_comparable word16_is_comparable. ndefinition word32_is_comparable_ext ≝ cn_is_comparable_ext word16_is_comparable_ext. unification hint 0 ≔ ⊢ carr (comp_base word32_is_comparable_ext) ≡ comp_num (comp_num (comp_num exadecim)). unification hint 0 ≔ ⊢ carr (comp_base word32_is_comparable_ext) ≡ comp_num (comp_num byte8). unification hint 0 ≔ ⊢ carr (comp_base word32_is_comparable_ext) ≡ comp_num word16. unification hint 0 ≔ ⊢ carr (comp_base word32_is_comparable_ext) ≡ word32. +unification hint 0 ≔ ⊢ carr word32_is_comparable ≡ comp_num (comp_num (comp_num exadecim)). +unification hint 0 ≔ ⊢ carr word32_is_comparable ≡ comp_num (comp_num byte8). +unification hint 0 ≔ ⊢ carr word32_is_comparable ≡ comp_num word16. +unification hint 0 ≔ ⊢ carr word32_is_comparable ≡ word32. (* operatore estensione unsigned *) ndefinition extu_w32 ≝ λw2.〈zeroc ?.w2〉. diff --git a/helm/software/matita/contribs/ng_assembly2/universe/universe.ma b/helm/software/matita/contribs/ng_assembly2/universe/universe.ma index 24e5e5a18..71eec785e 100755 --- a/helm/software/matita/contribs/ng_assembly2/universe/universe.ma +++ b/helm/software/matita/contribs/ng_assembly2/universe/universe.ma @@ -88,7 +88,7 @@ nlemma eq_to_eqSUN : ∀l.∀x,y:S_UN l.x = y → eq_SUN l x y = true. #u1; #dim1; #y; nelim y; #u2; #dim2; - nchange with (? → eqc ? u1 u2 = true); + nchange with (? → (eqc ? u1 u2) = true); #H; napply (eq_to_eqc ? u1 u2); napply (SUN_destruct_1 l … H). nqed. @@ -108,7 +108,7 @@ 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 ((eqc ? (getelem ? x) (getelem ? y) = true) → x = y); + nchange with (((eqc ? (getelem ? x) (getelem ? y)) = true) → x = y); #H; napply (eqSUN_to_eq_aux l x y (eqc_to_eq … H)). nqed. @@ -147,7 +147,7 @@ nlet rec farg1_auxT (T:Type) (l:ne_list nat) on l ≝ | ne_cons _ t ⇒ ProdT T (farg1_auxT T t) ]. -nlemma farg1_auxDim : ∀h,t,x.eqc ? x h = false → member_natList x (h§§t) = true → member_natList x t = true. +nlemma farg1_auxDim : ∀h,t,x.(eqc ? 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:(%); @@ -160,10 +160,10 @@ nlet rec farg1 (T:Type) (l:ne_list nat) on l ≝ [ 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 eqc ? (getelem ? x) h - return λy.eqc ? (getelem ? x) h = y → ? + return λy.(eqc ? (getelem ? x) h) = y → ? with - [ true ⇒ λp:(eqc ? (getelem ? x) h = true).fst … arg - | false ⇒ λp:(eqc ? (getelem ? x) h = false). + [ true ⇒ λp:((eqc ? (getelem ? x) h) = true).fst … arg + | false ⇒ λp:((eqc ? (getelem ? x) h) = false). farg1 T t (snd … arg) (S_EL t (getelem ? x) (farg1_auxDim h t (getelem ? x) p (getdim ? x))) @@ -176,10 +176,10 @@ nlet rec farg2 (T:Type) (l,lfix:ne_list nat) on l ≝ [ 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 eqc ? (getelem ? x) h - return λy.eqc ? (getelem ? x) h = y → ? + return λy.(eqc ? (getelem ? x) h) = y → ? with - [ true ⇒ λp:(eqc ? (getelem ? x) h = true).farg1 T lfix (fst … arg) - | false ⇒ λp:(eqc ? (getelem ? x) h = false). + [ true ⇒ λp:((eqc ? (getelem ? x) h) = true).farg1 T lfix (fst … arg) + | false ⇒ λp:((eqc ? (getelem ? x) h) = false). farg2 T t lfix (snd … arg) (S_EL t (getelem ? x) (farg1_auxDim h t (getelem ? x) p (getdim ? x))) -- 2.39.2