diff options
| author | Pierre-Marie Pédrot | 2016-09-07 17:46:53 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2016-09-07 17:46:53 +0200 |
| commit | 79e7a0de25bcb2f10a7f3d1960a8f16eefdbb5a6 (patch) | |
| tree | 92ce430c64b7bea374b926d81acc5433d39fdcbb /plugins/micromega/VarMap.v | |
| parent | f79f2b32da8e5e443428d4f642216ddfb404857c (diff) | |
| parent | a18fb93587ccbe32a2edfad38d2e9095f6c8e901 (diff) | |
Merge branch 'v8.6'
Diffstat (limited to 'plugins/micromega/VarMap.v')
| -rw-r--r-- | plugins/micromega/VarMap.v | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/plugins/micromega/VarMap.v b/plugins/micromega/VarMap.v index 4981ddb302..2d2c0bc77a 100644 --- a/plugins/micromega/VarMap.v +++ b/plugins/micromega/VarMap.v @@ -1,7 +1,7 @@ (* -*- coding: utf-8 -*- *) (************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) -(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2015 *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) @@ -26,6 +26,7 @@ Set Implicit Arguments. *) Section MakeVarMap. + Variable A : Type. Variable default : A. @@ -46,5 +47,29 @@ Section MakeVarMap. end. -End MakeVarMap. + Fixpoint singleton (x:positive) (v : A) : t := + match x with + | xH => Leaf v + | xO p => Node (singleton p v) default Empty + | xI p => Node Empty default (singleton p v) + end. + + Fixpoint vm_add (x: positive) (v : A) (m : t) {struct m} : t := + match m with + | Empty => singleton x v + | Leaf vl => + match x with + | xH => Leaf v + | xO p => Node (singleton p v) vl Empty + | xI p => Node Empty vl (singleton p v) + end + | Node l o r => + match x with + | xH => Node l v r + | xI p => Node l o (vm_add p v r) + | xO p => Node (vm_add p v l) o r + end + end. + +End MakeVarMap. |
